I have a silverlight application consuming data via RIA. Some methods are exposed in a way that they can be consumed in silverlight as well as in WPF application via Service Reference.On development, these services are called via localhost and everything works fine.I have set my hosts file so that it's all available at subdomain.domain.com.
Now (also after a couple of restarts) when I access .svc via different browsers, I get different responses in Chrome and in Internet explorer on the same URL.
Chrome shows:
[Name of] Service,
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: ...
You can also access the service description as a single file: ...
Internet explorer, Firefox shows:
[No name displayed] Service,
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: ...
the last part (second url, single file access link) is missing in internet explorer.
But the worst part is, if I enter the same url in VS2012 when adding a service reference, I get this message:
The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: ...
How can a service give three different responses to virtually the same request?
Update: Perhaps useful information is also that this service is not contained in a separate .svc file but is a ProjectDomainService.cs (and AuthenticationDomainService.cs) and .svc urls are somehow caught automatically (no such file exists on server).
And, Chrome behaves the same as Internet explorer if I remove
<add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
from web.config.
Also, pinging subdomain.domain.com shows my local IP as it should.
The problem seems like it was a simple ID-10-T error. Our company has automatic configuration script set for LAN settings under Internet options (connections).
Unchecking this made hosts entries available to all browsers and everything seems to work as expected/desired. While I did know proxies can cause problems when using hosts file, I was unaware of my system settings (it was not set so that it would be visible in settings, but hidden in a configuration file on a network share).
The only browser that worked under these (old) settings was the one that wasn't installed but a portable copy.
As this fixes my problems, I am not sure weather I can expect other unexpected issues now ... but at least it works.
Related
I am having problems connecting to this soap web service via a C# Xamarin.iOS app. I first tested it in a Windows form application and got it to work just fine. However trying to switch it over to a Xamarin.iOS app has been a royal pain.
For the Windows form, I simply used SvcUtil to create the output.config proxy settings and Service.cs file (AllPayData.cs in this case). Then added the contents of the config file to App.config and added the .cs file to the project. I can't follow the same procedure with my Xamarin app, mainly because there is no .config file to add the proxy to.
Following various Xamarin tutorials and examples, I came across the Silverlight tool SlSvcUtil, which created similar files as the other tool but the proxy file was simpler and the .cs file was made up all of async based methods. Wasn't too difficult to adjust to the change of the async methods, the tricky part was just trying to understand how the proxy could or should be tied into all of this. many of the tutorials showed creating an Endpoint object and using BasisHttpBinding to setup the proxy. Unfortunately I ran into this really annoying 415 error.
There was an error on processing web request: Status code 415(UnsupportedMediaType):
Cannot process the message because the content type 'text/xml;charset=utf-8'
was not the expected type 'application/soap+xml; charset=utf-8'."
I tried many different types of bindings including BasicHttpsBinding and WsHttpBinding along with many different options. I attempted to copy the setup verbatim from both of the .config files created by both tools (first one was WsHttpBinding, second one was BasicHttpBinding), but that still yielded error 415.
To me this error simply means that the requests I am sending to the API are in the wrong content type and are expected in a soap envelope (as expected). However, I have no idea on how to specify the content type within the bindings. :(
I re-added the first .cs file created by the first tool again (the one that worked with the Windows form, and attempted to apply the same binding code to it. I came up with an error indicating that MonoTouch does not allow dynamic creations of proxies. Boooo...
I attempted to add it as a web service by right clicking on my solution. It'll add all the mapping just fine, but nothing will be generated in the reference.cs file. I tried copying and pasting the existing .cs files that I already had into reference.cs, but still wound up with the same errors.
What am I missing here?? If all else fails, will I have to resort to manually making the soap api calls with C#? Or will that even work?
I'm wondering if any of you can shed some light on a problem I'm having.
I had a website located on an Amazon EC2 instance, it was working with no problems however the person who set it up located it the wrong region. As a result I've set up a new EC2 instance and zipped up the website directory.
I copied it across to the new instance and unzipped it.
Then I set up the website in IIS, it has it's own username so it doesn't run under IUSR. This use has full permissions to run the website and other than location, the setup is identical to that on the previous server.
However, when I go to adjust the connection string through IIS I get a message:
There was an error while performing this operation.
Details
Filename: \?{path to web config here}
Error:
I've not seen anything like this. I can open the web config in notepad++ and make changes with no issue. But the site reports the web config as malformed. Even using the exact web config from the working server this same message appears.
I've tried re-compacting the site on the working server and transferring again with exactly the same results.
Anyone got some advice on what I could try?
I'd be willing to bet that an extra module that you had installed on the old instance is not available on the new instance; I had a similar problem when I was using ther url-rewrite module of IIS on one instance, and moved the site to another instance that did not have that module installed and got a very similar (if not identical) error message - that would explain why the config was valid on one server, but not on the other.
You need to make sure all of the 'extra' options that were turned on in the old instance are available on the new instance, and I'd start by checking the rewrite module.
I have a website set up in iis 7.0 on my local win 7 machine. Within this are several webservices - they all can be accessed fine, and I can test this access by going to a browser and checking at http://localhost/test/service.svc. This works fine. I'm not trying to recreate this environment on VM with win server 2012 R2, and iis 8.5. I've set up everything identically, except then navigating to the url above returns on the 1k tb inside the actual service.src as if I opened it in notepad. If I try to add a reference to this service in VS, I get a better error and one that is related to the mime type for svc. Here's an example.
Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'file Extension' set to '.svc'.
Based on this issue, I then found a reference to needing to add something along the lines of to my config file which I do.
Now here's the interesting part. If I remove any references to the svc mime type in iis in both the server and the site, I receive a 404 not found error when trying to run a service. If I use the example above to add this with the config file, I receive a duplicate. If I take out the above example, and enter the mime type in either the server or the site, I then get a duplicate as well. I also found mention to this, and it seems there is some work around involving before the config inclusion as referenced above.
What's driving me the most crazy is that non of this is an issue on my local iis 7 machine. Does anyone have any suggestions, I'm floundering.
I have written a WCF web service (not a web site, just JSON over HTTP) intended to run in Azure. I need to write tests for it.
I know how to do this, but it seems amateurish:
Run the web service,
Copy the root URL (e.g. http://localhost:81/)
Apply the root URL to my test project,
Run the test project.
I would like to be able to do this:
Hit F5
--> web service starts running
--> tests start running, automatically finding where IIS decided to run the service.
Is there a way?
There are 2 ways you can do this. Since you're using Windows Azure I assume you're using the emulator. Using the emulator means that the RoleEnvironment is available and you can get a list of roles, their instances, and their endpoints that are available.
var endpoint = RoleEnvironment.Roles["WebRole1"].Instances.First().InstanceEndpoints["Endpoint1"];
var siteUrl = String.Format("{0}://{1}", endpoint.Protocol, endpoint.IPEndpoint);
This code will get the role named WebRole1, get the first instance on this role (you could use this to test if your web service supports load balancing) and get the InstanceEndpoint. The instance endpoint will give you all info you need like protocol (http/https) and the IP/port (these are things you configure in the ServiceConfiguration).
Note: This also works for processes running outside the emulator (like your test project). The only thing you'll need to do is reference Microsoft.WindowsAzure.ServiceRuntime.
Besides that you can also try to use the ServerManager class to find the current sites running in IIS, but I don't think this will work if you're running in IIS Express (which is also possible if you're working with Azure).
Fix the port number of the WCF project: go to the properties of your project, set "use dynamic ports" to false then specify a fixed number, for example 81.
Specify multiple startup projects in your solution: right mouse button on solution: select "set startup projects", then check the radiobutton "multiple startup projects", include your WCF service project in the startup list.
I hope this meets your needs...
i am connected to my clients network using vpn.
I need to use a exposed webservice of the Project server in their network.
when i tried the url http://server:port/service.asmx?wsdl in browser i get the wsdl.
But when i try to add web refrence in visual studio i says There is a error downloading the http://server:port/service.asmx?wsdl.could not resolve proxy.MycompanyDomain.com.
Why it is not by passing my company's domain. How to resolve it.
You could create a concrete WSDL by downloading the file from your browser and crating your web reference against the WSDL file rather than against the URL. This can be useful when you want to be sure you have a copy of the service interface at a point in time (particularly if the service is third party and may have unexpected changes that you want to flag back to them).