【茶包射手日記】更新 ASP.NET 網站後冒出 System.Security.Permissions.FileIOPermission 權限錯誤

栏目: ASP.NET · 发布时间: 6年前

内容简介:巧手一指,快速解掉同事遇到的鬼問題,自己都覺得神奇。ASP.NET Web Site 專案在部署用 wdproj 編譯 DLL 部署後壞掉,爆炸點出現在多處,幾個讀 Registry、開 SQL 連線的網頁噴出以下訊息:看到這個錯訊息腦中立刻浮現 - Trust Level! 與之前將部落格網站搬上 ASP.NET Hosting 空間信任層級不足時出現的錯誤訊息相同。(漫漫搬家路~~~)

巧手一指,快速解掉同事遇到的鬼問題,自己都覺得神奇。

ASP.NET Web Site 專案在部署用 wdproj 編譯 DLL 部署後壞掉,爆炸點出現在多處,幾個讀 Registry、開 SQL 連線的網頁噴出以下訊息:

Failed to load config XML: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  Exception Details: System.ApplicationException: Failed to load config XML: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

看到這個錯訊息腦中立刻浮現 - Trust Level! 與之前將部落格網站搬上 ASP.NET Hosting 空間信任層級不足時出現的錯誤訊息相同。(漫漫搬家路~~~)

但本次更新沒更動 web.config,檢查 IIS 管理員設定,站台的 Trust Level 是 Full 沒錯。於是我將箭頭指向本次部署更新的 App_Code.dll ,福至心靈打開檔案屬性檢查,果然...

【茶包射手日記】更新 ASP.NET 網站後冒出 System.Security.Permissions.FileIOPermission 權限錯誤

App_Code.dll 被註記為不可信任,會引發古怪問題,過去有交手經驗:

之前遇過網路下載 ZIP 解出 DLL 檔無法編譯,本案例則是從網路芳鄰解壓 ZIP 檔取出 DLL,解出的 DLL 也會被加上註記,但 ASP.NET 因此出錯的案例還是第一次遇到。另外,實測解鎖後建議 IISRESET 確保修改生效,而 DLL 解鎖後再次從網路分享解壓覆寫不會恢復鎖定狀態。

剛好知道 Trust Level、有組件被封鎖的經驗,才能第一時間找對方向解開問題。像我這種老骨頭,吃鹽吃得夠多還是有點優勢囉~

A case of assebmly downloaded from network can cause ASP.NET throw request for the permission failure exceptions.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Mastering JavaServer Faces

Mastering JavaServer Faces

Bill Dudney、Jonathan Lehr、Bill Willis、LeRoy Mattingly / Wiley / 2004-6-7 / USD 40.00

Harness the power of JavaServer Faces to create your own server-side user interfaces for the Web This innovative book arms you with the tools to utilize JavaServer Faces (JSF), a new standard that wi......一起来看看 《Mastering JavaServer Faces》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码