Search code examples
c#asp.netweb-servicessecurityexception

Security Exception with ASP.NET project in Visual Studio 11


I get this, to me, completely random error:

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

Stack Trace:

[SecurityException: Request for the permission of type'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral,     PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +42
System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +145
System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +73
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +111
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +279

Whenever I try to run my asp.net site that uses a service I created. The site is part of a project that also contains the service.

I don't use IIS or other stuff so don't tell me about that pool thing.

Edit: I always have it

  • New project with new service and web site;
  • Framework 1.0 tot 4.0;
  • Adding to in the web.config file;
  • It's got nothing to do with IIS;

I might need to add that It's on my NAS.

Solved, well, partly, It gave the error because it was on my NAS.


Solution

  • The solution to the problem is that it was located on my NAS and that caused security issues. Moving it to a folder in my PC solved the problem.