0

I've migrated my ASP.Net website from a UNC path on one server to a new UNC path on a new, bigger server.

After messing about with Code Access Security permissions in caspol and making sure the AppPool has the right settings, the website is working ok, with no wacky "PolicyException: Required permissions cannot be acquired" CAS errors.

The problem I have, though, is that there is a subdirectory configured as its own web application. That app is giving me a yellow-screen-of-death error:

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Now I know the site is running in Full Trust now, so why is this subdir app not working?

Community
  • 1
  • 1
Owen Blacker
  • 4,117
  • 2
  • 33
  • 70

1 Answers1

0

(Answering my own question at the same time as asking it)

Whilst lots of settings are inherited from the parent site, the following things are not necessarily (they are available in the Advanced Settings dialog for the subdirectory app):

  • Application Pool
  • Physical Path
  • Physical Path Credentials
  • Physical Path Credentials Logon Type
  • Enabled Protocols

Screenshot of IIS7 Advanced Settings dialog

Looking at the Advanced Settings for the application, I could see that the Physical Path was still referring to the old server's UNC path. Having changed the CAS policies, this would no longer work. Correcting the UNC path here made the problem go away.

Bonus points

The other tell-tale sign was a Warning-level entry in the Application log:

Event code: 3006
Event message: A parser error has occurred.
...
Event detail code: 0

Application information:

Application domain: /LM/W3SVC/3/ROOT/[redacted]
Trust level: Full
Application Virtual Path: [redacted]
Application Path: [old UNC path]
Machine name: [redacted]

Process information:

Process ID: 4592
Process name: w3wp.exe
Account name: [redacted]

Exception information:

Exception type: HttpException
Exception message: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Owen Blacker
  • 4,117
  • 2
  • 33
  • 70