views:

379

answers:

3

When the following line is called when running a website from the VS2008's web server i get a "The trust relationship between this workstation and the primary domain failed." exception.

if (User.IsInRole("SomeRole"))
...

I have turned UAC off, and set VS 2008, and it's built-in webserver, to run as an Administrator, and i have also rejoined my box to the domain. This code works fine if called from one of my Server 2003 boxes in IIS, and it always worked fine in Vista.

Any ideas on what may be causing this?

EDIT:

I just tried running it in IIS 7.5 on my local machine and i am getting the same error. Running it on Windows XP in IIS 5.1 and in the VS 2008 webserver works.

+1  A: 

Have you tried running VS2008 as administrator?

Harry
Just tried then and it still throws the exception.
holz
Running VS as Administrator worked for me.
mxmissile
A: 

The built in web server is cassini, which is a rather limited web server. You may have discovered a feature cassini doesn't have-- maybe it can't do kerberos. Here is more discussion about what Cassini doesn't have.

MatthewMartin
It runs fine in Cassini on Windows XP. Would the version of Cassini be differant on Win XP than Win7 x64? The issue also occurs in IIS 7.5 on win7.
holz
Actually now I'm really confused. I googled this error message. The likely culprit is something to do with the host OS, not the web server (of what ever variety), but I can't tell what machines you were running on you mention so many combinations some of which had to of been on different machines, some not. The work around is to stop using the built in webserver, which is what I did out of frustration many years ago. IIS 5.1 on XP simulates IIS 6.0 better than anything else (other than IIS 6.0)
MatthewMartin
+1  A: 

This was a Win7/Server2008 R2 bug. The error only occurred when connected to a Windows 2000 domain.

Hotfix available from here

holz