asp.net - 模拟共享主机信任级别

标签 asp.net permissions shared-hosting medium-trust

我想在我的开发机器上模拟共享托管环境的信任级别,以便在我部署解决方案时不会出现令人讨厌的意外。

我在 web.config 中添加了这个我的设置:

<trust level="Medium" originUrl="*"/>

唯一的问题是当我尝试保存到我的数据库时出现此异常:

InnerException: System.Security.SecurityException Message="Request for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." Source="mscorlib"



我如何在仍然保持中等“喜欢”信任的同时特别允许这样做。还有其他我可以合理允许的事情吗?我将在 GoDaddy 上托管。

最佳答案

我联系了Godaddy,得到了这样的答复:

GoDaddy.com ASP.NET shared hosting servers use the default Medium trust level with the addition of OleDbPermission, OdbcPermission, and a less-restrictive WebPermission.

Applications operating under a Medium trust level have no registry access, no access to the Windows event log, and cannot use reflection. Such applications can communicate only with a defined range of network addresses and file system access is limited to the application's virtual directory hierarchy. Please make sure that your application can work in a Medium trust environment if you are having any problems with it.



因此,人们可以将其用作共享主机权限通常是什么样的指示。

当我弄清楚如何创建@blowdards 链接中概述的这些权限时,我会发布它们。或者,如果有人可以发布一个很棒的示例。

关于asp.net - 模拟共享主机信任级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/693611/

相关文章:

c# - 如何从嵌套母版页中的内容页访问主母版页中的控件

php - PHP Comet 聊天系统的可扩展性问题

php - 权限不足,无法运行 typeperf.exe

ubuntu - 启动 jupyter notebook 时在 Ubuntu 上出现 SSLError : [SSL: EE_KEY_TOO_SMALL] ee key too small (_ssl. c:4022)

php - zend 和 htaccess 的问题

hosting - EC2 作为 Windows 的全职 VPS

asp.net - HTTP 错误 403.14 - 访问网站时出现禁止错误

c# - 检查 JToken 是否为空数组

asp.net - 启用 Application Insights 会使 Web 应用程序挂起

asp.net - 我需要更改什么才能允许IIS7 ASP.Net 3.5应用程序创建事件源并将事件记录到Windows EventLog?