2

設置新的開發工作站,當我從Visual Studio 2008運行ASP.NET(MVC)應用程序時出現SecurityException。任何想法可能是什麼問題?SecurityException:請求AspNetHostingPermission類型的權限失敗

我訪問過SMB數據文件(這是一個共享的安裝爲Z :)我已經運行

caspol -m -ag 1 -url "\\server\share\" FullTrust -exclusive on 

完整回溯給予了充分的信任,那就是:

Server Error in '/' Application.

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

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

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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

Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

回答

1

您是否使用指向遠程共享的虛擬目錄?
http://support.microsoft.com/?id=320268

而且看看「排除在ASP.NET常見的權限和安全相關的問題」
http://support.microsoft.com/?id=910449

+0

是的,我上午。你知道,如果在該鏈接的Web服務器引用IIS?因爲我正在使用Casini進行開發。 – Pablo 2009-10-28 06:51:00

+0

該鏈接指向IIS,但我認爲Casini具有相同的限制。您是否嘗試將FullTrust權限授予遠程共享? – Espo 2009-10-28 06:55:49

+0

我不懷疑卡西尼有相同的限制,我只是無法弄清楚如何解決它。您如何將FullTrust授予遠程共享? – Pablo 2009-10-28 07:05:33

1

下面是這爲我工作的命令:

C:\Windows\System32>C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "http://localhost/*" FullTrust

+1

我收到: ERRO:錯誤代碼:m 錯誤:無效的選項:m – Tony 2012-10-11 00:05:07

+0

好的,我嘗試了上面的複製粘貼。它不起作用的原因是因爲米前的連字符不是真正的連字符。 – Bobort 2012-11-15 22:38:02

+0

儘管如此,它仍然不適合我。 – Bobort 2012-11-15 22:40:34

相關問題