System.ServiceModel.AddressAccessDeniedException

本文介绍了解决在Windows环境下使用WCF服务时遇到的HTTP无法注册URL的问题及解决方法。通过调整URL访问权限,使进程能够在指定端口上成功启动服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

发生了 System.ServiceModel.AddressAccessDeniedException
  HResult=0x80131501
  Message=HTTP 无法注册 URL http://+:8998/MyHellowWord/AppServer/。进程不具有此命名空间的访问权限(有关详细信息,请参见 http://go.microsoft.com/fwlink/?LinkId=70353)。
  Source=System.ServiceModel
  StackTrace:
   在 System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
   在 System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
   在 System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
   在 System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.HttpChannelListener`1.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   在 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   在 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   在 System.ServiceModel.Channels.CommunicationObject.Open()
   在 MyHellowWord.Program.Main(String[] args) 在 G:\Projects\HellowWord\MyHellowWord\MyHellowWord\Program.cs 中: 第 16 行


内部异常 1:

HttpListenerException: 拒绝访问。


解决办法:

管理员运行cmd:

输入:netsh http add urlacl url=http://+:8998/ user="\Everyone"

(netsh http add urlacl url=http://+:8998/AutoSystemMessageService.svc/ user="\Everyone")


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值