【问题标题】:The Security Support Provider Interface (SSPI) negotiation failed安全支持提供程序接口 (SSPI) 协商失败
【发布时间】:2014-05-31 01:56:17
【问题描述】:

我的自定义 asp.net 出现错误 我的代码asp代码:

IServiceConfiguration<IOrganizationService> orgConfigInfo =
                 ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc"));
var creds = new ClientCredentials();
creds.UserName.UserName = "user";

creds.UserName.Password = "pass";

using (_serviceProxy = new OrganizationServiceProxy(orgConfigInfo, creds))
{

    // This statement is required to enable early-bound type support.
            _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());


    _service = (IOrganizationService)_serviceProxy;


    using (context srv = new context(_service))
    {
        Account acc = new Account();
        acc.thr_FirstName = firstname.Text;
        acc.thr_LastName = lastname.Text;
        acc.thr_NationalCode = nationalcode.Text;
        acc.EMailAddress1 = email.Text;
        acc.thr_Mobile = cellphone.Text;
        acc.Telephone1 = tel.Text;
        srv.AddObject(acc);
        srv.SaveChanges();
        alert.ForeColor = System.Drawing.Color.Green;
        alert.Text = "با موفقیت ثبت شد";
    }
}

然后当我在我的 Visual Studio 中运行此代码时可以正常工作,但是当我在 iis 中运行时出现此错误

安全支持提供程序接口 (SSPI) 协商失败。

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.ComponentModel.Win32Exception:安全支持提供程序接口 (SSPI) 协商失败。

来源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

[Win32Exception (0x80004005):安全支持提供程序接口 (SSPI) 协商失败。] System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding 通道绑定, ExtendedProtectionPolicy protectionPolicy) +6115112 System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(消息incomingMessage,SspiNegotiationTokenProviderState sspiState)+1325 System.ServiceModel.Security.IssuanceTokenProviderBase1.GetNextOutgoingMessage(Message incomingMessage, T negotiationState) +91 System.ServiceModel.Security.IssuanceTokenProviderBase1.DoNegotiation(TimeSpan timeout) +586

[SecurityNegotiationException: 与目标“http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc”的 SOAP 安全协商 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' 失败。有关更多详细信息,请参阅内部异常。] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14489026 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型) +622 Microsoft.Xrm.Sdk.IOrganizationService.Execute(组织请求请求)+0 Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(组织请求请求)+892 Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(组织请求请求)+254 Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest request, IList`1 results) +43

[SaveChangesException:处理此请求时发生错误。] Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions 选项)+1791 crm.Reg.submit_Click(对象发送者,EventArgs e)+790 System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串 eventArgument)+155 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

【问题讨论】:

  • 安全支持提供程序接口 (SSPI) 协商失败
  • 你应该把你的问题中的错误信息作为线索。

标签: asp.net security dynamics-crm-2011 crm


【解决方案1】:

由于时区导致此错误发生,因为服务器托管在其他时区与运行 Web 应用程序的本地时区不同的其他区域。

要解决这个问题,服务器必须管理每个时区的偏移量,最简单的方法是管理 UTC 格式的时间。了解更多关于 UTC 点击here

【讨论】:

    猜你喜欢
    • 2011-04-01
    • 2011-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多