I have a web service set up for NAV 2009 R2. It works well when I am trying to access it through the browser. However, when I am trying to consume the webservice in C# (code below), I am getting an internal server error 500 and the event log states that I need delegation/impersonation setups. The weird thing is that the SQL Server, Web Service, and NST are all on the same computer. I am using my domain user as the services account for all three services (doesn't matter if I switch those to Network Service). I do not have access to the domain to set up delegation, so I didn't try this yet. But this should not even be happening in my eyes. When I create credentials using a windows login and password and assign it as the credentials, I have no problem accessing the webservice. Does anyone have any ideas please?
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(CreateURL(_SystemService));
request.UseDefaultCredentials = true; // THIS IS THE ISSUE?
request.Method = "GET";
request.ContentType = "text/xml; charset=utf-8";
request.Accept = "text/xml";
WebResponse response = await request.GetResponseAsync();
StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
Just as a sidenote: Yes, I know I could add the service as a reference, but it doesn't work in this scenario, so I have to work through "GET" and "POST" to communicate with the service. As I said - it all works fine if I use defined credentials, which I can't really do in the deployed production environment.
Peter Zentner
NAV Practice Manager at Clients First Business Solutions
Did you check out our free training videos at
www.dynamics-nav-training.com?
Look at our
blogs.
Comments
NAV Practice Manager at Clients First Business Solutions
Did you check out our free training videos at www.dynamics-nav-training.com?
Look at our blogs.