将ASP.NET站点升级到.NET 4后,SSPI协商失败错误

时间:2010-12-22 04:26:36

标签: c# asp.net wcf iis-7 wcf-security

当站点部署在服务器上时会出现此错误,但在我的开发箱上正常工作。

让我提供一些关于如何设置一切的快速背景。

应用程序( WebApp )部署到运行IIS 7.0的Windows Server 2008 SP2。网站中有两个应用程序: WebApp WebService 。服务器不是域的一部分,而是在本地网络上。

WebService 包含WCF Web服务(svc),尚未修改。我可以连接到此并按预期使用它。

我从ASP.NET 3.5 sp1将 WebApp 升级到ASP.NET 4,后者具有WCF Web服务的客户端代理(通过添加服务引用生成)。升级之前一切正常。升级后,我可以运行它并从我的开发箱(在域上)正确使用它,它可以按预期使用 WebService 。当我将站点部署到服务器并访问它时,我收到以下错误(使用堆栈跟踪更新,仅包括每条消息后的第一行):

[Win32Exception (0x80004005): The Security Support Provider Interface (SSPI) negotiation failed.]
System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding channelbinding, ExtendedProtectionPolicy protectionPolicy) +3705927

[SecurityNegotiationException: SOAP security negotiation with 'http://server.mydoamin.com/WebService/TestService.svc' for target 'http://server.mydoamin.com/WebService/TestService.svc' failed. See inner exception for more details.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +9464367

[HttpException (0x80004005): SOAP security negotiation with 'http://server.mydoamin.com/WebService/TestService.svc' for target 'http://server.mydoamin.com/WebService/TestService.svc' failed. See inner exception for more details.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9028953

[HttpException (0x80004005): SOAP security negotiation with 'http://server.mydoamin.com/WebService/TestService.svc' for target 'http://server.mydoamin.com/WebService/TestService.svc' failed. See inner exception for more details.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8950644

我在IIS中做的唯一更改是将应用程序池设置为.NET 4。

我已经过测试,可以从非域计算机连接并使用 WebService 而不会出现任何问题。它在我的开发箱(在域上)上工作正常。

我正在使用wsHttpBinding并使用本地(到服务器)windows用户帐户的用户名/密码进行身份验证。我在客户端代理的ClientCredentials.Windows.ClientCredential属性上设置了用户/密码。

这是我在客户端绑定下的安全配置(它是所有自动生成器,我没有通过添加服务引用来修改它):

<security mode="Message">
  <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
  <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
</security>

同样,如果asp.net站点是从服务器以外的某个地方运行的,那么一切都能正常工作。

我很感激任何建议。谢谢!

1 个答案:

答案 0 :(得分:1)

尝试重新安装.net4分发文件。 有时,当你启用一些.net3.5函数时会引起奇怪的问题。