Is it possible to create a standalone, C# web service deployed as an EXE or Windows service?

喜欢而已 提交于 2019-11-29 05:33:52

Yes, it's possible, you may want to have a look at WCF and Self Hosting.

Yes, it is possible (and fairly easy).

Here is a CodeProject article showing how to make a basic HTTP server in C#. This could easily be put in a standalone EXE or service, and used as a web service.

One technology you might want to check out is WCF. WCF can be a bit of a pain to get into but there's a great screencast over at DNRTV by Keith Elder that shows how to get started with WCF in a very simple fashion.

http://www.dnrtv.com/default.aspx?showNum=135

You could take a look at HttpListener in the .Net framework.

I would highly recommend WCF. It would fit very well into a product like you are describing. There are a good number of books available.

Sure, you can do that. Be sure to change the Output Type of the project to Console Application. Then, in your Main function, add a string[] parameter. Off of some switch that you receive on the command line, you can branch to ServiceBase.Run to run as a Windows Service or branch to some other code to run a console application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!