1

当我尝试访问调用 WCF 函数的表单时,我不断收到此错误。实际上它可以在我的本地机器上运行,但是当它在服务器中时,会发生这种情况:(

源错误:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

堆栈跟踪:

[WebException: The remote server returned an error: (401) Unauthorized.]
 System.Net.HttpWebRequest.GetResponse() +6115603
 System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +48

 [MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.]
 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +9439503
 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +345
 Project.WCFUser.Users.HaveAccess(String userid, String filename) +0
 Project.WCFUser.Users.HaveAccess(String userid, String filename) in C:\Documents and Settings\MyPC\My Documents\Visual Studio 2010\Project\Project\Project\Service References\Users\Reference.cs:71
 Project.View.User.Details.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\MyPC\My Documents\Visual Studio 2010\Project\Project\Project\View\User\Details.aspx.cs:50
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
4

1 回答 1

2

通过更改我在 web.config 中的安全设置解决了这个错误

<security mode="TransportCredentialOnly">
      <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
于 2012-07-23T04:17:56.537 回答