IT Troubleshooting

Friday, October 13, 2006

Error Compiling and Publishing Website in Visual Studio 2005

I was getting the following compilation error when trying to publish or build my website that I was working on in Visual Studio 2005:

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

I was running Visual Studio 2005 on my workstation and my website was on a web server and I had a local drive letter (Y:) mapped to that folder. I was trying to publish to another web server that I had mapped to (X:). By following these steps, the error went away, the site compiled and I was able to publish it:

  1. On the workstation that you're developing on, go to Administrative Tools > Microsoft .NET Framework 2.0 Configuration
  2. Expand to .Net Framework 2.0 Configuration > My Computer > Runtime Security Policy > Machine > Code Groups > All_Code.
  3. Right click the All_Code node and choose New.
  4. Call the new code group anything you'd like and click the Next button.
  5. From the pulldown choose "URL" and in the URL textbox that displays type:
    file:////\\y:\*
  6. Click the Next button.
  7. Select the "Use existing permission set" pulldown and select "Full Trust".
  8. Close Visual Studio 2005, open it again and it should compile.

0 Comments:

Post a Comment

<< Home