开发者

WCF Service doesnt run on IIS!

开发者 https://www.devze.com 2022-12-30 08:29 出处:网络
I have a WCF service hosted at local IIS. I created a ASP.NET website that consumes this service hosted at IIS.

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 s开发者_Python百科ame setup when runs from Visual Studio WebDev Server, doesnt function from IIS!

Any know isues?

Please help!

Thanks


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)


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
    


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消