NAV 2009 NavDatabasePasswordException - Dynamics CRM Plugin

SudheeshSudheesh Member Posts: 5
edited 2009-02-25 in NAV Three Tier
Hi All,

I am getting the following exception in event viewer while trying to execute a small piece of code from a Dynamics CRM Plug-in (plug-in registered as Administrator).
Event Type:	Error
Event Source:	MicrosoftDynamicsNAVServer
Event Category:	None
Event ID:	0
Date:		2/21/2009
Time:		7:35:38 PM
User:		N/A
Computer:	<computer Name>
Description:
User: 
Type: Microsoft.Dynamics.Nav.Types.NavDatabasePasswordException
SuppressMessage: False
FatalityScope: None
Message: The user ID and password are invalid. Try again.
StackTrace:
     at Microsoft.Dynamics.Nav.Runtime.NavRuntimeAdapter.ErrorHandler(Int32 errorCode, Int32 errorNumber, Int32 moduleNumber, String errorText)

This same code runs fine when executed from a c# program.

This is a single computer installation. I am running Demo Installation of Dynamics NAV 2009 with Dynamics CRM 4.0. I have logged on to CRM using Administrator account. All services including SQL Server, Dynamics NAV and Dynamics CRM are running in Administrator account. I tried changing everything to LOCAL SERVICE and restarted the services. But no help. I am using my partner license.

the code unit that consumes webservice is as follows.
ProjectMgmt mgmt = new ProjectMgmt();
mgmt.UseDefaultCredentials = true;
mgmt.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Codeunit/ProjectMgmt";
mgmt.CreateProject("From CRM");

The above code works fine when run from a c# application in the same system.

Answers

  • SudheeshSudheesh Member Posts: 5
    After setting the network credentials, the code started working. I am not clear why default credentials is not working. I will be very happy if someone could share their thoughts

    mgmt.UseDefaultCredentials = false;
    mgmt.Credentials = new System.Net.NetworkCredential ("Administrator","pass@word1", "LITWAREINC");

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Crm.Sdk;
    using Microsoft.Crm.SdkTypeProxy;
    
    namespace SendToNAV
    {
    	using NavWS;
    	public class SendToNAV : IPlugin
    	{
    	public void Execute(IPluginExecutionContext context)
    		{
    			ProjectMgmt mgmt = new ProjectMgmt();
    			//mgmt.UseDefaultCredentials = true;
    			mgmt.UseDefaultCredentials = false;
    			mgmt.Credentials = new System.Net.NetworkCredential("Administrator","pass@word1", "LITWAREINC");
    			mgmt.Url = "http://moss:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Codeunit/ProjectMgmt";
    			mgmt.CreateProject("From CRM");
    		}
    		
    	}
    }
    
Sign In or Register to comment.