简体   繁体   English

WCF自托管应用程序和名称空间预留

[英]WCF self hosting application and namespace reservation

I'm new to WCF, trying to learn the basics. 我是WCF的新手,试图学习基础知识。

I've created a simple C# console application that self hosts (by using the ServiceHost class) a simple service. 我创建了一个简单的C#控制台应用程序,它自己托管(通过使用ServiceHost类)一个简单的服务。

Whenever i attempt to run it, i get an exception regarding namespace reservation. 每当我尝试运行它时,我都会遇到名称空间保留的例外情况。

I've found some command (netsh) to prevent this from happening, however i am wondering if this is a must when self hosting a service? 我发现了一些命令(netsh)来防止这种情况发生,但是我想知道这是否必须在自托管服务时?

I'd like to be able to deploy services ("agents") remotely on machines without doing massive amount of work, and be able to communicate with them. 我希望能够在机器上远程部署服务(“代理”)而无需进行大量工作,并能够与它们进行通信。

If you do not have to ensure compatibility with existing clients, one workaround could be to use a different binding for your service. 如果您不必确保与现有客户端的兼容性,则一种解决方法可能是为您的服务使用不同的绑定 If you are not tied to http you could for example use net.tcp instead. 如果你没有绑定http,你可以使用net.tcp代替。 This works without namespace reservation and does not require administrator privileges. 这不需要命名空间,也不需要管理员权限。

See this chart for the features provided by the different bindings 有关不同绑定提供的功能,请参见此图表

The short cut would be to run your servicehost width administrator privileges. 捷径就是运行servicehost宽度管理员权限。 Once you want to host your services live, you should consider hosting them using IIS 一旦您想要实时托管服务,您应该考虑使用IIS托管它们

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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