Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

unable to login to dynamics CRMOrganizationServiceProxy is null

(2) ShareShare
ReportReport
Posted on by 76
Really short question:
This is working:
 
string userName = "username";
string password = @"password";
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = userName;
credentials.UserName.Password = password;
Uri serviceUri = new Uri("https://myDomain/OrgName/XRMServices/2011/Organization.svc");
OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
proxy.EnableProxyTypes();
IOrganizationService crmService = (IOrganizationService)proxy;
crmService works as wanted. Retrieve, Update, delete.... everything works fine.
 
THIS is not working - but only in one project (wcf-service) in many other (sample wcf, other console-apps) it work's fine:
var connectionString = "Url=url; Username=username; Password=password; Domain=domain; AuthType=IFD;";
var conn = new CrmServiceClient(connectionString);
Both the OrganizationServiceProxy and the OrganizationWebProxyClient is null,  message as subject: unable to connect....
 
the connectionString is correct, because this connectionString works on other applications. Also I created another wcf-Application from scratch and only try to establish a connection. It works fine.
 
This problem costs me lots of time and still no solution found :(
Categories:
  • Suggested answer
    Daivat Vartak (v-9davar) Profile Picture
    5,229 Super User 2025 Season 1 on at
    unable to login to dynamics CRMOrganizationServiceProxy is null
    Hello Axi Bachlechner,
     

    You've hit a tricky and frustrating situation where the CrmServiceClient is failing to connect in a specific WCF service project, despite working fine in others. This points to a project-specific configuration or dependency issue.

    Let's systematically troubleshoot this:

    1. Project-Specific Configuration Differences:

    • Target Framework:

      • Ensure that the failing WCF service project is using the same target .NET Framework version as the working projects.
      • Mismatched frameworks can sometimes cause compatibility issues with the Dynamics 365 SDK. 

    • NuGet Packages:

      • SDK Version: Verify that the versions of the Microsoft.CrmSdk.CoreAssemblies and Microsoft.CrmSdk.XrmTooling.CoreAssembly NuGet packages are identical across all projects.
      • Package Conflicts: There might be conflicting NuGet packages in the failing project. Try to remove all non-essential packages and only keep the CRM Sdk packages.
      • Package Reinstallation: Try uninstalling and reinstalling the CRM SDK packages in the failing project. 

    • App.config/Web.config:

      • Binding Redirects: Check the app.config or web.config for any unexpected binding redirects that might be interfering with the CRM SDK.
      • Security settings: Check the security settings in the config file. There might be a difference between the working and non working project. 

    • Build Configuration:

      • Ensure that the build configurations (Debug, Release) are consistent across all projects.
      • Try to rebuild the project, and clean the solution. 

      •  

    2. WCF Service-Specific Issues:

    • Hosting Environment:

      • If the WCF service is hosted in IIS, ensure that the application pool has the necessary permissions to connect to Dynamics 365.
      • If it is a self hosted WCF, there might be a network or firewall issue. 

    • Service Behaviors:

      • Check the WCF service behaviors for any custom configurations that might be interfering with the CRM SDK.
      • Check for any custom error handling, that might be hiding the real error. 

    • Service Endpoints:

      • Verify that the service endpoints are correctly configured. 

    • Authentication Context:

      • WCF services can have different authentication contexts than console applications. Check the WCF service authentication settings. 

      •  

    3. Dependency Conflicts:

    • Assembly Conflicts:

      • Use the Assembly Binding Log Viewer (fuslogvw.exe) to check for assembly loading errors and conflicts.
      • This tool can help identify if different versions of the CRM SDK assemblies are being loaded. 

    • Third-Party Libraries:

      • If the WCF service project uses third-party libraries, there might be conflicts with the CRM SDK.
      • Try to create a new WCF project from scratch, and add the functionality step by step, to isolate the problem.  

    •  

    4. Code Isolation:

    • Minimal Reproduction:

      • Create a very simple WCF service method that only attempts to establish a CrmServiceClient connection.
      • This will help isolate the problem and rule out any complex logic in your existing service. 

    • Debugging:

      • Attach a debugger to the WCF service and step through the CrmServiceClient constructor to identify the exact point of failure.
      • Check the inner exceptions. They often contain the real cause of the problem.  

    •  

    Troubleshooting Steps:

    1. Compare Project Configurations: Carefully compare the project configurations (target framework, NuGet packages, app.config/web.config) between the working and non-working projects.
    2. Use Assembly Binding Log Viewer: Run fuslogvw.exe to check for assembly loading errors.
    3. Create Minimal Reproduction: Create a simple WCF service method to isolate the problem.
    4. Debug the Code: Attach a debugger and step through the CrmServiceClient constructor.
    5. Check WCF Service Settings: Verify the WCF service hosting environment, service behaviors, and endpoints.
    6. Reinstall NuGet Packages: Try reinstalling the CRM SDK NuGet packages in the failing project.

    7.  

    By systematically working through these steps, you should be able to identify the root cause of the connection failure in your WCF service project.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,639 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,663 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans