ASP.NET應用程序拋出System.Security.SecurityException

[英]System.Security.SecurityException thrown by ASP.NET application


Trying to get an ASP application deployed; it worked for a while but then started coming up with errors whenever the page is accessed:

試圖部署ASP應用程序;它工作了一段時間,但每當訪問頁面時都會出現錯誤:

Server Error in '/AppNameHere' 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.

異常詳細信息:System.Security.SecurityException:對類型'System.Web.AspNetHostingPermission,System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的權限的請求失敗。

An IISreset didn't change anything, but rebooting the entire system got it to work for a few hours before the problem came back. The .config for the application is set to full trust.

IISreset沒有改變任何東西,但重新啟動整個系統讓它在問題恢復之前工作了幾個小時。應用程序的.config設置為完全信任。

What could be causing this, and how can it be fixed? (Or, if more information is needed, where do I go looking to find it)

可能導致這種情況的原因是什么? (或者,如果需要更多信息,我在哪里尋找它)

2 个解决方案

#1


2  

Found the following on Jason Gaylord's blog:

在Jason Gaylord的博客上找到以下內容:

System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

使用Visual Studio 2005訪問網絡或Intranet項目時的System.Web.AspNetHostingPermission

I rebuilt one of my development machines recently and attempted to access a project that I had out on a network share. I continually received project messages about the project not being trusted. I remembered that I had to change something but couldn't remember what it was until I found an old note I left in Outlook.

我最近重建了一台開發機器,並試圖訪問我在網絡共享上的項目。我不斷收到關於項目不受信任的項目消息。我記得我必須改變一些但不記得是什么,直到我發現我留在Outlook中的舊筆記。

The message I would receive in Visual Studio 2005 was: ASP.NET runtime error: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

我將在Visual Studio 2005中收到的消息是:ASP.NET運行時錯誤:請求類型'System.Web.AspNetHostingPermission,System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的權限失敗。

To resolve this issue, you must change your development machine .net security configuration since you are accessing items across the network. In the event that you need this ability at runtime, you must change the trust level in your config file to full. However, since this is only in development,

要解決此問題,您必須更改開發計算機.net安全配置,因為您正在通過網絡訪問項目。如果您在運行時需要此功能,則必須將配置文件中的信任級別更改為完全。但是,由於這只是在開發中,

  1. I can change my local PC's security by going to Start > Control Panel > Administrative Tools > Microsoft .NET Framework 2.0 Configuration.

    我可以通過轉到“開始”>“控制面板”>“管理工具”>“Microsoft .NET Framework 2.0配置”來更改本地PC的安全性。

  2. After it fully loads (sometimes takes a bit), fully expand My Computer in the navigation tree and click Runtime Security Policy.

    完全加載后(有時需要一點),在導航樹中完全展開“我的電腦”,然后單擊“運行時安全策略”。

  3. In the right hand pane, choose Adjust Zone Security. Leave the default option (Make changes to this computer) and hit next.

    在右側窗格中,選擇“調整區域安全性”。保留默認選項(對此計算機進行更改),然后單擊下一步。

  4. Choose Local Intranet and change the trust level to Full Trust. Then choose next and then finish.

    選擇“本地Intranet”,將信任級別更改為“完全信任”。然后選擇下一步然后完成。

  5. Restart Visual Studio 2005 and you should be all set.

    重新啟動Visual Studio 2005,您應該全部設置。

This worked for me ... so hopefully this will work for you!

這對我有用......所以希望這對你有用!

#2


1  

This link may be of help:

此鏈接可能有所幫助:

http://forums.asp.net/t/909639.aspx


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2008/10/30/721272271d2e07c9018582167a295c62.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com