[英]Getting “System.Security.SecurityException: That assembly does not allow partially trusted callers” when published on shared server
I have a asp.net website uploaded on shared hosting server but for some pages I am getting "SecurityException". 我有一个asp.net网站上传共享托管服务器,但对于一些页面我得到“SecurityException”。 This page has no html body, only the code written in page_load event of this page.
此页面没有html正文,只有本页面的page_load事件中编写的代码。 The reason behind removal of html body was like this page will act as an api so that 3rd party will create a webrequest and will get the appropriate response from the page.
删除html正文背后的原因就是这个页面将充当api,以便第三方创建webrequest并从页面获得适当的响应。 On localhost it works fine, but when uploaded the above error occurs.
在localhost上它工作正常,但上传时出现上述错误。 I have used many 3rd party dlls which are required for systematic flow of the project.
我使用了许多第三方dll,这是项目系统化流程所必需的。
Exception details: Small description : System.Security.SecurityException: That assembly does not allow partially trusted callers. 异常详细信息: 小描述 :System.Security.SecurityException:该程序集不允许部分信任的调用者。
Detailed 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.
要授予此应用程序所需的权限,请与您的系统管理员联系或在配置文件中更改应用程序的信任级别。
I also tried doing trust level full in web.config file, but did not worked. 我也尝试在web.config文件中完成信任级别,但没有奏效。
I had a similar problem. 我遇到了类似的问题。
It was solved via the following configuration - 它通过以下配置解决 -
<system.web>
<trust level="Full" />
Be careful to use uppercase F for Full. 小心使用大写字母F表示完整。 Lowercase f generates the following error (which cost me a few hours) -
小写f生成以下错误(这花了我几个小时) -
"Unable to read the security policy file for trust level 'full'." “无法读取信任级别'完整'的安全策略文件。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.