模拟共享主机信任级别
我想在我的开发计算机上模拟共享托管环境的信任级别,以便在部署解决方案时不会出现令人讨厌的意外情况。
我在 web.config 设置中添加了这个:
<trust level="Medium" originUrl="*"/>
唯一的问题是当我尝试保存到数据库时遇到此异常:
内部异常: 系统安全异常 Message="请求类型权限 'System.Net.SocketPermission,系统, 版本=2.0.0.0,文化=中立, 公钥令牌=b77a5c561934e089' 失败的。” 来源=“mscorlib”
我如何明确允许这一点,同时仍保持中等“喜欢”信任。 还有其他我可以合理允许的事情吗? 我将在 GoDaddy 上托管。
I want to simulate the trust levels of a shared hosting environment on my development machine so that there are no nasty surprises when I come to deploy my solution.
I added this my setting the web.config:
<trust level="Medium" originUrl="*"/>
The only problem with this is that I'm getting this exception when I try to save to my database:
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"
How do I specifically allow this while still maintaining medium 'like' trust. Are there other things I can resonably allow?. Ill be hosting on GoDaddy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我联系了 Godaddy,得到了这样的回复:
因此,人们可以使用它来指示共享托管权限的一般情况。
当我弄清楚如何创建这些权限(如 @blowdards 链接中所述)时,我会将其发布。 或者如果有人可以发布一个例子,那就太好了。
I contacted Godaddy, and got this responce:
So people can use this as an indication of what shared hosting permissions are generally like.
When I figure out how to create these permissions as outlined in @blowdards link ill post them. Or if anyone could post an example that would be great.
因此,您拥有的是默认的中等信任,并且您看到的错误是正确的。
当然,服务器管理员可以根据自己的喜好进行调整,您只需要准确了解他们对默认信任策略进行了哪些更改即可。 您可以按照 MSDN。 现在你需要做的就是找出 godaddy 对他们做了什么:)
So what you have is the default medium trust, and the error you are seeing is right.
Of course the server admin can adjust this all they like, you just need to find out exactly what changes they made to the default trust policy. You can create a custom trust level by following the steps outlined on MSDN. Now all you need to do is find out exactly what godaddy has done to theirs :)