locked
CRM 4.0: "RecognizeCrmUser() was called on an instance that already has an UserId" RRS feed

  • Question

  • Hi, we are still running CRM 4.0 (Migration to CRM 2013 is under way) and want to implement an interface with a 3rd party app. But whenever the interface sends a SOAP request, IIS returns a "500 Internal Server Error", and the following event is logged:

    Fault bucket , type 0
    Event Name: CRMmanaged
    Response: Not available
    Cab Id: 0
    
    Problem signature:
    P1: 4.0.7333.3822
    P2: w3wp
    P3: Microsoft.Crm
    P4: BaseCrmIdentity.RecognizeCrmUser() was called on an instance that already has an UserId.;Hash='-545257351'
    P5: 
    P6: 
    P7: 
    P8: 
    P9: 
    P10: 
    
    Attached files:
    C:\Windows\Temp\tmp260F.tmp
    
    These files may be available here:
    C:\ProgramData\Microsoft\Windows\WER\ReportQueue\NonCritical_4.0.7333.3822_403da37097dd2c175f85abfc74a7dd1f45a644e2_cab_2faa2738
    
    Analysis symbol: 
    Rechecking for solution: 0
    Report Id: fb79a3b8-3719-11e4-aee3-00155e658e66
    Report Status: 4

    The mentioned details file contains this:

    Exception generated at: 08.09.2014 07:35:46 Error Type: System.Web.Services.Protocols.SoapException Error Message: Server was unable to process request. Error Stack Trace: System.Web.Services.Protocols.SoapException: Server was unable to process request. --->

    System.InvalidOperationException: BaseCrmIdentity.RecognizeCrmUser() was called on an instance that already has an UserId. at Microsoft.Crm.Authentication.BaseCrmIdentity.RecognizeCrmUser(Guid organizationId) at Microsoft.Crm.Sdk.Crm2007.RetrieveCrmTicketRequest.Process(IDiscoveryServiceProvider serviceProvider) --- End of inner exception stack trace --- InnerException: Error Type: System.InvalidOperationException Error Message: BaseCrmIdentity.RecognizeCrmUser() was called on an instance that already has an UserId. Error Stack Trace: System.InvalidOperationException: BaseCrmIdentity.RecognizeCrmUser() was called on an instance that already has an UserId. at Microsoft.Crm.Authentication.BaseCrmIdentity.RecognizeCrmUser(Guid organizationId) at Microsoft.Crm.Sdk.Crm2007.RetrieveCrmTicketRequest.Process(IDiscoveryServiceProvider serviceProvider) Stack Frame: at DefaultExceptionHandler.Handle(Stream to, Stream from, Exception exception) at CompositeSoapExtensionExceptionHandler.Handle(Stream to, Stream from, Exception exception) at DiscoveryServiceSoapExtension.ProcessMessage(SoapMessage message) at SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException) at SoapServerProtocol.WriteException(Exception e, Stream outputStream) at WebServiceHandler.WriteException(Exception e) at WebServiceHandler.Invoke() at WebServiceHandler.CoreProcessRequest() at SyncSessionlessHandler.ProcessRequest(HttpContext context) at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at ApplicationStepManager.ResumeSteps(Exception error) at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr) at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)


    The SOAP interface called http://servername/crminstance/mscrmservices/2007/AD/crmdiscoveryservice.asmx with header

    SoapAction="http://schemas.microsoft.com/crm/2007/CrmDiscoveryService/Execute"

    and body

    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body><Execute xmlns="http://schemas.microsoft.com/crm/2007/CrmDiscoveryService">
    <Request xsi:type="RetrieveCrmTicketRequest"><OrganizationName>CRM Instance</OrganizationName>
    </Request></Execute></soap:Body></soap:Envelope>

    It authenticates with Windows Authentication and a Domain account that has full permissions in CRM. Anonymous authentication is disabled in IIS.

    Does anyone have an idea what could be wrong? Thanks!


    • Edited by svhelden Monday, September 8, 2014 5:46 AM added line break
    Monday, September 8, 2014 5:45 AM

Answers

  • Seems like the interface simply used the wrong URL:

    http://servername/crminstance/mscrmservices/2007/AD/crmdiscoveryservice.asmx

    Since CrmDiscoveryService is intended to discover the existing instances, the URL must not contain the instance name:

    http://servername/mscrmservices/2007/AD/crmdiscoveryservice.asmx


    • Marked as answer by svhelden Monday, August 24, 2015 5:23 AM
    Thursday, September 18, 2014 8:50 AM