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!
Thanks
You basically need
You basically have three options to deploy your service implementation:
you can put your service implementation into the code-behind file of the SVC file – that would be my least favourable option – basically don’t do it – it gets messy and offers no benefit
you can put your service class file (the MyService.cs file) and the interface file (IMyService.cs) into the
App_Codedirectory (if you’re using a Web Site project type) – again, I don’t particularly like this approachyour best option: put your service contract (the interface) and your service implementation into a separate class-library assembly for that service, and deploy that
MyService.dllinto the.\bindirectory below the virtual directory where your SVC file lives.Then add a *.svc file (pure text file) to your virtual directory, which contains:
And of course, you need the appropriate web.config entries – but I’m sure you already have those, right?
Your service address now is:
For more info, see How to: Host a WCF Service in IIS