什么是最常见的,典型的事情,以避免编码进入我的ASP.NET应用程序,以便它下中等信任一个共享的主机上运行? [英] What are the most common, typical things to AVOID coding into my ASP.NET app in order for it to run under Medium Trust on a shared host?

查看:163
本文介绍了什么是最常见的,典型的事情,以避免编码进入我的ASP.NET应用程序,以便它下中等信任一个共享的主机上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么东西,中等信任阻止你在做什么?举例来说,我已经了解到,中等信任你停止使用System.IO.Path.GetTempPath()。还有什么其他类似的事情?

What are the things that Medium Trust stops you from doing? For example, I've already learned that Medium Trust stops you from using System.IO.Path.GetTempPath(). What other things like that?

推荐答案

下面是如何了解和解决信任问题。

Here's how to learn about and resolve trust issues.

1)搜索您的Windows \\ Microsoft.NET \\框架[您的版本] \\的文件夹CONFIG:

1) Search your Windows\Microsoft.NET\Framework[YOUR VERSION]\CONFIG folders for the files:


  • 的web.config(这是根的配置文件)

  • web_mediumtrust.config

  • web_hightrust.config

2)改变web.config中说

2) Change the web.config to say

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

3)试试你的ASP.NET应用程序。矿失败,权限错误。

3) Try your ASP.NET app. Mine failed with a permission error.

4)DIFF在一个diff工具,就像在的WinMerge和web_mediumtrust.config web_hightrust.config。

4) Diff the web_mediumtrust.config and web_hightrust.config in a diff tool, like WinMerge.

5)从高到中等一次复制设置,看看它们是如何影响你的应用程序。在我的情况下,错误消息中提到ConfigurationPermission,所以很容易诊断。

5) Copy settings from the high to the medium one at a time and see how they affect your app. In my case, the error message referred to ConfigurationPermission, so it was easy to diagnose.

如果你能牵制在web_mediumtrust.config文件中的precise线卡住你,那么也许你可以与你的托管公司分享,并有工作的事情了更好的机会。

If you can pin down the precise lines in the web_mediumtrust.config file that are blocking you, then maybe you can share that with your hosting company and have a better chance of working things out.

在这里更多的文档:

http://msdn.microsoft.com/en-us/library/aa302425.aspx

@Oli,我的应用程序的的GoDaddy的托管,我不得不做一些变通方法,在code当我开始使用Lucene.NET。我不得不修改Lucene.NET源$ C ​​$ C不使用GetTempPath和System.IO.FileInfo。

@Oli, my app IS hosted at GoDaddy and I had to do some workarounds in code when I started using Lucene.NET. I had to modify the Lucene.NET source code to not use GetTempPath and System.IO.FileInfo.

这篇关于什么是最常见的,典型的事情,以避免编码进入我的ASP.NET应用程序,以便它下中等信任一个共享的主机上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆