简体   繁体   English

使用Windows服务的WCF服务

[英]WCF Service with Windows Service

I create WCF service library and i test that working fine on WCF Test client(default). 我创建WCF服务库,我测试在WCF测试客户端上工作正常(默认)。 when i host the WCF service in winodws service that time i got the error. 当我在winodws服务中托管WCF服务时,我得到了错误。 I am using windows XP, .Net 3.5 and Visual Studio 2008. and also to set the URL to urlacl concept using HTTPCFG.exe, that time also i got same error that given below. 我正在使用Windows XP,.Net 3.5和Visual Studio 2008.并且还使用HTTPCFG.exe将URL设置为urlacl概念,那时我也得到了相同的错误,如下所示。

Error opening host : HTTP could not register URL "http://+:8731/WCFServerDLL/Service1/." 打开主机时出错:HTTP无法注册URL“http:// +:8731 / WCFServerDLL / Service1 /。” Your process does not have access rights to this namespace (see "http://go.microsoft.com/fwlink/?LinkId=70353" for details). 您的进程没有此命名空间的访问权限(有关详细信息,请参阅“http://go.microsoft.com/fwlink/?LinkId=70353”)。

windows XP sp3. Windows XP SP3。

Here i run the "httpcfg.exe set urlacl /u http://localhost:8731/WCFServerDLL/Service1/ /a "D:..."" 在这里我运行“httpcfg.exe set urlacl / u http:// localhost:8731 / WCFServerDLL / Service1 / / a”D:...“”

i get the result 我得到了结果

HttpSetServiceConfiguration completed with 0. HttpSetServiceConfiguration用0完成。

Set the URL also in xp using httpcfg.but i got same error. 使用httpcfg也在xp中设置URL。但是我得到了同样的错误。

You have to add a WCF namespace exception. 您必须添加WCF命名空间异常。 Use this command 使用此命令

netsh.exe http add urlacl url=http://+:8731/ user={computername}\\{username} netsh.exe http add urlacl url = http:// +:8731 / user = {computername} \\ {username}

Edit: 编辑:

Im sorry, netsh is for Vista and 7, I just noticed you were on XP. 对不起,netsh适用于Vista和7,我只是注意到你在使用XP。 Im not as familiar with XP but I belive the following will work. 我不熟悉XP,但我相信以下内容会起作用。 Make sure to replace myhost. 确保替换myhost。

httpcfg.exe set urlacl /u http://myhost:8731/ /a httpcfg.exe设置urlacl / u http:// myhost:8731 //一个

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

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