Wcf HTTP无法注册URL(远程调试)
C#,Windows 7。Wcf HTTP无法注册URL(远程调试),wcf,remote-debugging,Wcf,Remote Debugging,C#,Windows 7。 我编写了一个AutoCAD插件并使用远程调试(MS Visual Studio)。我的插件必须作为WCF服务工作。AutoCAD是非托管应用程序,必须作为“我的服务”的主机。我正在读一本关于WCF的书,我试着使用它。我无法将acad.exe.config用于我的服务设置:我没有权限。所以我自己做(我将从xml文件中读取它们,但稍后在重构之后)。我的“服务器”代码(此代码由AutoCAD启动): 我得到一个异常(查看代码注释): 但是http://go.microsof
我编写了一个AutoCAD插件并使用远程调试(MS Visual Studio)。我的插件必须作为WCF服务工作。AutoCAD是非托管应用程序,必须作为“我的服务”的主机。我正在读一本关于WCF的书,我试着使用它。我无法将acad.exe.config用于我的服务设置:我没有权限。所以我自己做(我将从xml文件中读取它们,但稍后在重构之后)。我的“服务器”代码(此代码由AutoCAD启动): 我得到一个异常(查看代码注释): 但是
http://go.microsoft.com/fwlink/?LinkId=70353
页面不存在。我尝试以管理员的身份发布MSVisualStudio2013(我读过这篇文章),但这对我没有帮助(请看下面的第2页)
另外,如果我以管理员身份启动AutoCAD,则一切正常。P.S.2如果我以管理员的身份启动远程调试器,那么所有调试器也可以正常工作。
但我需要像普通用户一样使用它。我可以在没有管理员权限的情况下启动服务(托管在AutoCAD中)吗?这可能是因为AutoCAD没有在HTTP.SYS中注册端口所需的权限。在这种情况下,您有两种选择:
private static void RunServices() {
Ap.Document doc = cad.DocumentManager.MdiActiveDocument;
try {
Uri address = new Uri("http://localhost:8000/CadService");
BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "httpBinding";
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.Security.Mode = BasicHttpSecurityMode.None;
host = new ServiceHost(typeof(CadService));
host.AddServiceEndpoint(typeof(ICadService), binding, address);
host.Open(); // I get an Exception here...
if (doc != null) {
doc.Editor.WriteMessage("Service launched.\n");
}
}
catch (Exception ex) {
if (doc != null) {
doc.Editor.WriteMessage("Exception: {0}\n", ex.Message);
}
}
}
Exception: HTTP could not register URL http://+:8000/CadServices/.
Your process does not have access rights to this namespace
(see http://go.microsoft.com/fwlink/?LinkId=70353 for details).