开发者

How to Host a Restful WCF Web Service

I would like to create a RESTful web service that I can deploy o开发者_运维问答n an IIS 7 web server. I was going through some tutorials and came across the WebServiceHost class.

From what I understand, I should be able to use this and have it on IIS with no configuration required.

Is that true? If not, what is the simplest deployment option for this type of Web Service. I am hoping there are options where I don't need to do too much with IIS 7.


Code snippets you see with WebServiceHost pertain to hosting your service in a Windows service that you create or in a console application.

You can directly host it in IIS. Not extra code required. You will however have to add additional configuration settings in the web.config.

See this article ... http://msdn.microsoft.com/en-us/library/bb412178.aspx

Relevant snippet from the above article ...

You can also host such a service within IIS. To do this, specify the WebServiceHostFactory class in a .svc file as the following code demonstrates.

<%ServiceHost 
language=c#
Debug="true"
Service="Microsoft.Samples.Service"
Factory=System.ServiceModel.Activation.WebServiceHostFactory%>


Check out WCF Data Services.

http://msdn.microsoft.com/en-us/data/bb931106

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜