M
Marshall
Hello,
I am running W2k3, Visual Studio 2003, Framework version 1.1.4322. I have
one simple asp.net web service and one simple asp.net web app. When I run
the web service directly (http://localhost/mywebservice/Service.asmx)
everything works fine. When I try to call the web service from my web app I
always get the same error:
System.Net.WebException: The request failed with HTTP status 401:
Unauthorized
I also see a new event in my System event log:
Source: Kerberos
Event Id: 4
The kerberos client received a KRB_AP_ERR_MODIFIED error from the server
host/mbell2.<mydomain>. The target name used was HTTP/mbell2.<mydomain>.
This indicates that the password used to encrypt the kerberos service ticket
is different than that on the target server. Commonly, this is due to
identically named machine accounts in the target realm (<mydomain>), and
the client realm. Please contact your system administrator.
I have searched Google Groups what seems like 100 times and I have tried
(what seems like) everything.
Here is my web method:
// Security commented out.
// Security works when running directly
// from http://localhost/...
//[PrincipalPermission(SecurityAction.Demand,
Role=@"MyDomain\RoleMapWS_Admins")]
[WebMethod]
public bool EnableUser(int userId)
{
try
{
(new UserDAO()).EnableAccount(userId);
return true;
}
catch (Exception ex)
{
throw;
}
}
Here is my web app:
// Private to class
private Open.WebServices.RoleMap.Service ws = new
Open.WebServices.RoleMap.Service();
...
private void Button1_Click(object sender, System.EventArgs e)
{
ICredentials cred = new NetworkCredential(@"mbell", "open",
"MyDomain");
ws.PreAuthenticate = true;
// I have tried
// ws.Credentials = cred;
ws.Credentials = cred.GetCredential(new Uri(ws.Url), "");
try
{
ws.EnableUser(2);
}
catch (Exception ex)
{
throw;
}
}
Thank you for your help,
Marshall
I am running W2k3, Visual Studio 2003, Framework version 1.1.4322. I have
one simple asp.net web service and one simple asp.net web app. When I run
the web service directly (http://localhost/mywebservice/Service.asmx)
everything works fine. When I try to call the web service from my web app I
always get the same error:
System.Net.WebException: The request failed with HTTP status 401:
Unauthorized
I also see a new event in my System event log:
Source: Kerberos
Event Id: 4
The kerberos client received a KRB_AP_ERR_MODIFIED error from the server
host/mbell2.<mydomain>. The target name used was HTTP/mbell2.<mydomain>.
This indicates that the password used to encrypt the kerberos service ticket
is different than that on the target server. Commonly, this is due to
identically named machine accounts in the target realm (<mydomain>), and
the client realm. Please contact your system administrator.
I have searched Google Groups what seems like 100 times and I have tried
(what seems like) everything.
Here is my web method:
// Security commented out.
// Security works when running directly
// from http://localhost/...
//[PrincipalPermission(SecurityAction.Demand,
Role=@"MyDomain\RoleMapWS_Admins")]
[WebMethod]
public bool EnableUser(int userId)
{
try
{
(new UserDAO()).EnableAccount(userId);
return true;
}
catch (Exception ex)
{
throw;
}
}
Here is my web app:
// Private to class
private Open.WebServices.RoleMap.Service ws = new
Open.WebServices.RoleMap.Service();
...
private void Button1_Click(object sender, System.EventArgs e)
{
ICredentials cred = new NetworkCredential(@"mbell", "open",
"MyDomain");
ws.PreAuthenticate = true;
// I have tried
// ws.Credentials = cred;
ws.Credentials = cred.GetCredential(new Uri(ws.Url), "");
try
{
ws.EnableUser(2);
}
catch (Exception ex)
{
throw;
}
}
Thank you for your help,
Marshall