The Security Support Provider Interface (SSPI) negotiation failed

1

I have error for my custom asp.net my code asp code:

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 = "با موفقیت ثبت شد";
    }
}

and then when i run this code in my visual studio work correctly but when i run in iis i get this error

The Security Support Provider Interface (SSPI) negotiation failed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: The Security Support Provider Interface (SSPI) negotiation failed.

Source Error:

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.

Stack Trace:

[Win32Exception (0x80004005): The Security Support Provider Interface (SSPI) negotiation failed.] System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding channelbinding, ExtendedProtectionPolicy protectionPolicy) +6115112 System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState) +1325 System.ServiceModel.Security.IssuanceTokenProviderBase1.GetNextOutgoingMessage(Message incomingMessage, T negotiationState) +91 System.ServiceModel.Security.IssuanceTokenProviderBase1.DoNegotiation(TimeSpan timeout) +586

[SecurityNegotiationException: SOAP security negotiation with 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' for target 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' failed. See inner exception for more details.] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14489026 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +622 Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request) +0 Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request) +892 Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) +254 Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest request, IList`1 results) +43

[SaveChangesException: An error occured while processing this request.] Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions options) +1791 crm.Reg.submit_Click(Object sender, EventArgs e) +790 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

asp.net
security
dynamics-crm-2011
crm
asked on Stack Overflow Apr 16, 2014 by Vahid Samimi • edited Apr 16, 2014 by Vahid Samimi

1 Answer

0

this error occurs due to the time zone as the server is hosted on some other region which has a different time zone then the local timezone where the web application is running.

to solve this problem server have to manage the offset of every timezone and the simplest way to do it tom manage the time in UTC format. to learn more about UTC click here

answered on Stack Overflow Jul 13, 2020 by Vahid Samimi • edited Mar 2, 2021 by Ali Asgher Badshah

User contributions licensed under CC BY-SA 3.0