WCF service over HTTP in an Azure worker role?

Deadly 提交于 2020-01-13 17:09:53

问题


I understand that you are able to open port 80 on an Azure worker role and run a WCF service publicly. I am, however, having trouble coming up with a scenario where it makes more sense to do it this way as opposed to running in a web role. Any ideas?


回答1:


A WCF service hosted in a worker role will essentially be self-hosted: From your OnStart(), you'd create a new ServiceHost() and go from there.

A WCF service hosted in a web role would be taking advantage of IIS to host the service, as an svc, taking advantage of IIS performance counters, caching, automatic activation, process recycling, etc.

Even more interesting: In a web role where you host your website, you could still run a self-hosted WCF service the same way as in a worker role. You'll just need to create another input endpoint on some other port (or an internal endpoint, usable by only your Windows Azure web/worker role instances in your deployment).

And yet another scenario: By running a self-hosted service, you're not limited to .net - fire up any executable that knows how to listen to a port. This opens up opportunities to host a Java service host, python, etc.



来源:https://stackoverflow.com/questions/5971256/wcf-service-over-http-in-an-azure-worker-role

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