2012-05-10 93 views
3

尝试运行WCF服务会产生以下结果。我试过在页面上提到的netsh相关建议 http://msdn.microsoft.com/en-us/library/ms733768.aspx 并没有得到任何工作。请帮助提供有关如何解决此问题的信息。WCF访问被拒绝异常

在此先感谢。

{"HTTP could not register URL http://+:8439/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."} 

    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener) 
    at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback) 
    at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open() 
    at TestThreadSync.Form1.ListenOnChannel() in C:\Users\MyAccount\Desktop\TestService\Form1.cs:line 51 
    at TestThreadSync.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\MyAccount\Desktop\TestService\Form1.cs:line 32 
    at System.Windows.Forms.Form.OnLoad(EventArgs e) 
    at System.Windows.Forms.Form.OnCreateControl() 
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 
    at System.Windows.Forms.Control.CreateControl() 
    at System.Windows.Forms.Control.WmShowWindow(Message& m) 
    at System.Windows.Forms.Control.WndProc(Message& m) 
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m) 
    at System.Windows.Forms.ContainerControl.WndProc(Message& m) 
    at System.Windows.Forms.Form.WmShowWindow(Message& m) 
    at System.Windows.Forms.Form.WndProc(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 
    at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow) 
    at System.Windows.Forms.Control.SetVisibleCore(Boolean value) 
    at System.Windows.Forms.Form.SetVisibleCore(Boolean value) 
    at System.Windows.Forms.Control.set_Visible(Boolean value) 
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) 
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) 
    at System.Windows.Forms.Application.Run(Form mainForm) 
    at TestThreadSync.Program.Main() in C:\Users\MyAccount\Desktop\TestService\Program.cs:line 18 

回答

7

两个选项(或者两个都可以使用)

1.使用Netsh实用程序提供到端口

netsh http添加urlacl URL = http访问:// +:8439 /用户=域\用户名

http://blogs.msdn.com/b/amitlale/archive/2007/01/29/addressaccessdeniedexception-cause-and-solution.aspx

2.Admin权限才能

以管理员身份运行(Visual Studio或应用程序本身)

+0

我尝试了第一个。这次尝试是成功的,但没有解决问题。但是,当我尝试跟随第二个时,我现在得到不同的异常消息*** {“注册已存在URI'http://127.0.0.1:8439/'."}*** – user272671

+0

使用[ netsh http delete urlacl url = http:// +:8439 ...](http://msdn.microsoft.com/en-us/library/windows/desktop/cc307231(v = vs.85).aspx) – Tilak

+0

我已经删除它,但例外***注册已经存在的URI **持续 – user272671

相关问题