Dear all,
in my asp.net application, on ASPX page need consume K2 REST service using the code below:
private const string WORKLISTRESTURL = "http://myserver.domain.com:81/K2Services/REST.svc/Worklist/Items";
HttpWebRequest request = WebRequest.Create(WORKLISTRESTURL) as HttpWebRequest;
request.Credentials = CredentialCache.DefaultNetworkCredentials;
XDocument responseDocument;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
using (Stream responseStream = response.GetResponseStream())
using (XmlReader responseReader = XmlReader.Create(responseStream))
{
responseDocument = XDocument.Load(responseReader);
}
When the code is executed, it return error:
Exception Details: System.ComponentModel.Win32Exception: The target principal name is incorrect
Source Error:
Line 25: // get response Line 26: XDocument responseDocument; Line 27: using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) Line 28: using (Stream responseStream = response.GetResponseStream()) Line 29: using (XmlReader responseReader = XmlReader.Create(responseStream)) |
While if I directly key in "http://myserver.domain.com:81/K2Services/REST.svc/Worklist/Items" in browser, it can return data correctly.
What could be wrong with the server/development PC setting?
Thank and regards,
SH