Hosting WCF service RRS feed

  • Question

  • Hi,


    I have been working on a Silverlight app that consumes a WCF service. [on Visual Studio]

    as a matter of simplicity I created a WCF service in the project itself [as-in I didnt host it in IIS, but let the build-in webdev server in VS do it for me]

    It works well, now I want to deploy it on IIS 7.0, can you tell me If i would need to host the service independently and then the remaining stuff or if I just publish the website, the service would be hosted too and the Silverlight client would be able to communicate with the service.


    Please help!


    Saturday, May 15, 2010 4:02 PM


All replies

  • If you simply publish the website, your service should be deployed as well. The only caveat is that, if you used "Add Service Reference" to add a client to the service in your silverlight app, you may need to update the address in the file ServiceReference.ClientConfig to point to the updated location of the service (in IIS).
    • Proposed as answer by Carlos Figueira Friday, May 21, 2010 8:34 AM
    • Marked as answer by Mog Liang Monday, May 24, 2010 2:33 AM
    Saturday, May 15, 2010 8:02 PM
  • Hi Jayesh,

    WCF can be hosted within .NET web application(together with ASP.NET web pages), you don't need to separate the WCF service(xxx.svc endponits) out of the existing web application. However, when removing from visual studio test server to IIS server, there does have something need to take care(especially for the IIS server application/virtual dir configurations). Here are some online references might help you:

    #Screencast: Hosting WCF services in ASP.NET/IIS

    #endpoint.tv Screencast - Configuring WCF Service References

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Proposed as answer by Carlos Figueira Friday, May 21, 2010 8:34 AM
    • Marked as answer by Mog Liang Monday, May 24, 2010 2:33 AM
    Monday, May 17, 2010 9:10 AM
  • Hi,

      If you want to consume WCF service in Silverlight application and if you want to use IIS 7 as a host, then the root of IIS should have clientaccesspolicy.xml file, this will help in managinf cross-domain calls from Silverlight to WCF services. For better use, I recommands that isolate WCF service form the ASP.NET application (means in separate WCF project in VS2008/VS2010) and then publish it on Web Server. Then add its service reference in Silverlight client application.




    Mahesh Sabnis 

    Friday, May 21, 2010 12:15 PM