简体   繁体   中英

Host a WCF Service in a Application

I developed a WCF application, and I want to package it in a program which can be installed by normal user without installing Visual Studio or IIS on his machine.

This WCF will be called remotely from another machnine using the machine IP Address.

What do you suggest for this case ?

You could host the WCF service in a console app. The obvious downside to this is that someone would have to start the console app on the host machine first in order for the WCF service to be available remotely. Chances are, you want 24/7/365 access to the WCF service, in which case you'll want to host it in a Windows service if IIS is not an option. That said, check out this SO question for how to leverage your Windows service as a console application to simplify debugging.

As to the choice of binding, I have always found this chart helpful.

WCF绑定选择流程图 .

Since you explicitly mentioned using the machine's IP address, I would lean toward NetTcpBinding assuming firewalls are not going to be a problem.

You can host your WCF Services as a Windows Service, and use the Http Endpoint.

Also, check this link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM