tags:

views:

38

answers:

3

Hi,

I have a WCF service hosted at local IIS. I created a ASP.NET website that consumes this service hosted at IIS.

While running it from Visual Studio WebDev Server, everything works fine, but as soon as i run the same website [after hosting in IIS] from the browser, the website doesnt seem to be communicating with the Service!

The same setup when runs from Visual Studio WebDev Server, doesnt function from IIS!

Any know isues?

Please help!

Thanks

A: 

I bet it's the address - when using Add Service Reference it will hardcode "localhost" into your ClientConfig file on the client.

Check this and implement a way to change over to your real (IIS) address at deploy time.

(A way to check you have the right deploy-time address is to pull it up in a browser, try navigating to "http://yoururl.com/MyService.svc" you should get a page that will link to the WSDL, letting you make sure you have the right address.. this is the address your client should look for)

Bobby
Check the .ClientConfig file in the project that is consuming the service. If it says localhost in there, then this is the problem
Bobby
A: 

Couple of things to check:

  • do you have a SVC file? Where is it located?
  • do you connect to the correct service address? It would be:

    http://YourServerName/YourVirtualDirectory/YourServiceFile.svc
    

    This is the address that you get when hosting in IIS - you cannot override that in your web.config, no matter how hard you try.

  • are the configurations for binding etc. identical on server and client?
  • have you turned on HttpGetEnabled for the service metadata? Can you navigate to the WSDL address and get the WSDL back??

    http://YourServerName/YourVirtualDirectory/YourServiceFile.svc?wsdl
    
marc_s
Well, everythign u mentioned is done!1. I have hosted my WCF service in IIS.2. My website is still not hosted, I run it from the Visual Studio, it can communicate with Service. Everything runs alrite3. I move my website to IIS, rest everything same, it communicates with the same WCF service hosted in IIS4. Now when I run my website from IIS, it does not communicate with the service!I'm clueless!
James
It is now returning an error "System.ServiceModel.CommunicationException The Remote Server returned an error: Not Found"! However, I just tried to find out if the service was running, I printed the Service state and it was Opened, which meant that the service was there and listening! it is only when I call a contract it returns this error!
James
please see my comment, I'm 99% sure it's the address. Check the .ClientConfig file in the project that is consuming the service. If it says localhost in there, then this is the problem.
Bobby
A: 

It sounds like you are not resetting the Service reference when you move it to the webserver. What you need to do after you have completed testing is to move your Service to be hosted by IIS, so deploy it to the server. Then you will need to re-reference, or update your reference in our web app before you deploy it.

Typically when testing your service it will run in the dev server at http://localhost:someport/myservice.svc

When you deploy it to IIS it will run on http://myserver.com/PossibleVDIR/myservice.svc

Once you take care of this you should be fine.

John Wiese