gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 12:26:04 25 4
gpt4 key购买 nike

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

我在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com