0
我在我的asp.net項目(Server 2008,VS2008)中使用Npgsql.dll。我的開發環境是Server 2003和VS 2008這個DLL工程對我的開發環境很好,但我發佈這個生產時,它拋出以下異常:第三方DLL的Asp.net FileIOPermission異常
System.TypeInitializationException: The type initializer for 'Npgsql.NpgsqlConnectionStringBuilder' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase)
at System.Reflection.Assembly.GetName(Boolean copiedName)
at Npgsql.NpgsqlConnectionStringBuilder..cctor()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PathDiscovery="C:\inetpub\wwwroot\MENU_MDS\MWareAuthService\bin\Npgsql.DLL"/>
The demand was for:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PathDiscovery="C:\inetpub\wwwroot\MENU_MDS\MWareAuthService\bin\Npgsql.DLL"/>
The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access="Open"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota="512000"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard="OwnClipboard"/>
<IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PublicKeyBlob="00240000048000009400000006020000002400005253413100040000010001002B3C590B2A4E3D347E6878DC0FF4D21EB056A50420250C6617044330701D35C98078A5DF97A62D83C9A2DB2D072523A8FC491398254C6B89329B8C1DCEF43A1E7AA16153BCEA2AE9A471145624826F60D7C8E71CD025B554A0177BD935A7809629F0A7AFC778EBB4AD033E1BF512C1A9C6CEEA26B077BC46CAC93800435E77EE"
Name="Npgsql"
AssemblyVersion="2.0.5.0"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url="file:///C:/inetpub/wwwroot/MENU_MDS/MWareAuthService/bin/Npgsql.DLL"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Internet"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="SafePrinting"/>
</PermissionSet>
The assembly or AppDomain that failed was:
Npgsql, Version=2.0.5.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7 The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///C:/inetpub/wwwroot/MENU_MDS/MWareAuthService/bin/Npgsql.DLL
--- End of inner exception stack trace ---
at Npgsql.NpgsqlConnectionStringBuilder..ctor(String connectionString)
at Npgsql.NpgsqlConnection..ctor(String ConnectionString)
at MWareAuthService.MWareAuthService.Login(String username, String password, String ipaddress)
我會很感激在這個問題上的任何幫助。
是否使用記錄Npgsql的?它試圖寫入一個指定的文件,也許這是給你權限問題... –