1

I have a Web forms application that runs fine in Visual Studio 2012 but when I run int in VS 2013 I get

System.SystemException occurred
Message: A first chance exception of type 'System.SystemException' occurred in mscorlib.dll
Additional information: The trust relationship between the primary domain and the trusted domain failed.

for a stacktrace when loading up the inital page. I am not sure where to start in trying to figure out what is causing the issue. Its running on the same framework version and has the same web config

Update .... I switch Visual Studio 2012 to use IIS Express and now get the same exception in VS 2012 and VS 2013. Now to resolve the exception ?

Any idea ?

Micah Armantrout
  • 6,781
  • 4
  • 40
  • 66

2 Answers2

2

This is because 2013 does not use cassini web server but instead uses IIS Express. This can happen in Visual Studio 2012 as well if you enable IIS Express instead of Cassini. To fix this follow these steps:

In visual studio click on your web project and then press F4

1) Anonymous Authentication needs to be disabled

2) Windows Authentication needs to be enabled

enter image description here

Note: if one of these are grayed out that means that you have a override in your IIS Express Config file which is located

\My Documents\IISExpress\config\applicationhost.config

Check for

 <section name="anonymousAuthentication" overrideModeDefault="Allow"/>

or

<section name="windowsAuthentication" overrideModeDefault="Allow" />

More information:

http://msdn.microsoft.com/en-us/magazine/hh288080.aspx

http://www.codegorilla.com/2012/12/how-to-enable-windows-authentication-when-using-iisexpress/

Micah Armantrout
  • 6,781
  • 4
  • 40
  • 66
1

From the error I'm making the assumption that you are using windows authentication..

You can get this error if you are calling isInRole and pass a role that doesn't exist..

HttpContext.Current.User.IsInRole("SomeMadeUpRole");

With regards to the difference between running in 2012 and 2013, 2013 uses IIS Express which is basically a cut down IIS 7.5 instead of 7...

Not 100% sure on this though, would be glad to hear if this helps!

D3vy
  • 831
  • 7
  • 19
  • Yes I am using windows Auth but the roles exist? all thats changing is VS2012 to VS 2013 both are pointing to the same AD server – Micah Armantrout Apr 29 '14 at 00:44
  • Hi, First thing that I would do is check the project properties in bot versions of VS. Make sure that the Servers section on the web tab is the same between the two (I suspect that 2012 is using the Visual studio development server and 2013 is using IIS express. Change them both to be the same and you should be ok). – D3vy Apr 29 '14 at 12:08
  • I know 2012 is not using iis express but the custom Webserver with VS 2012 not sure about 2013 I will check and let you know – Micah Armantrout Apr 29 '14 at 12:11
  • ok VS 2013 is running in IIS Express VS 2012 is using WebDev.WebServer40.exe so that does give me something to go on – Micah Armantrout Apr 29 '14 at 12:56
  • I switch VS 2012 to use IIS Express and I now get the same exception using VS 2012 .... maybe the web.config should be different ? because I am using IIS Express ? – Micah Armantrout Apr 29 '14 at 13:03
  • Figured it out and have a answer if your interested – Micah Armantrout Apr 29 '14 at 13:56
  • Hi, Good to hear you got it going! Yeah, it would be good to know for future reference, we are moving on to an intranet project shortly and may encounter similar issues! – D3vy Apr 30 '14 at 10:35