WCF RIA Services Class Library and Deployment
Following the walkthrough at http://msdn.microsoft.com/en-us/library/ee707351(v=VS.91).aspx I have a working Silverlight solution that employs a WCF RIA Services Class Library. I am now stuck on how to deploy this to a production server.
In a previous project (not using RIA services) that used a standard WCF Class Library I had to create a seperate web application to host the services. When it came to deployment it was obvious that I needed to deploy both the front-end (Silverlight hosting) web app and the server (WCF hosting) web app and everything worked well.
With the WCF RIA Services Class library solution there is only one web app in the solution. I am presuming that since the solution works in VS, the service is somehow being hosted in the same web app that was created for the 开发者_如何学运维Silverlight front-end but this is not visibly clear. Anyhow, I deployed the application using Web Deploy (as I have done other apps before) but it does not work. I didn't really expect it to!
Can anyone point me in the right direction?
When you link the .web RIA class library projects to your main web project, the services are accessed behind the scenes by URLs like:
http://localhost:2911/ClientBin/RiaServices-Documents-Web-DocumentDomainService.svc/binary/GetDocuments?$take=20&$includeTotalCount=True
The client RIA class library projects just assume a relative URL (relative to the hosting project), so they will work in any Silverlight application.
The only requirement is that you link the RIA service ".Web" project to the website hosting your Silverlight app. That will place the required service relative to the clientbin folder, ready to be consumed.
I had not installed RIA on the IIS Server because I received a message that led me to believe that you couldn't do it. However there is a command prompt command to do a special Server install see here msdn.microsoft.com/en-us/library/ff426913(v=VS.91).aspx. It now works by simply deploying the Web project.
精彩评论