【问题标题】:How to compile ASP.NET 2.0 applications in medium trust如何以中等信任编译 ASP.NET 2.0 应用程序
【发布时间】:2012-03-31 15:07:21
【问题描述】:

我正在使用 .Net/C# 脚本上传 XLS 文件,然后转储到 SQL SERVER。

它在本地服务器上工作得很好,但在共享主机空间上却不行。主机在说

“您似乎在此应用程序中使用了完全信任,并且我们在共享服务器上支持中等信任,因此您收到此错误消息。请以中等信任重新编译应用程序,然后检查它。”

我问他们如何重新编译它 Medium Trust,但他们让我在 google 上搜索,我没有找到任何帮助。

我应该在 web.config 中更改一些内容吗?

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    更改 webconfig 文件中的设置..

    <system.web>
        <trust level="Medium" originUrl="" />
    

    【讨论】:

      【解决方案2】:

      ASP.NET Web applications to run in medium trust. If you host multiple applications on the same server, you can use code access security and the medium trust level to provide application isolation. By setting and locking the trust level in the machine-level Web.config file, you can establish security policies for all Web applications on the server. Running at medium trust with ASP.NET version 2.0 is easier than with ASP.NET version 1.1 because when using ASP.NET 2.0, you have access to Microsoft SQL Server databases at medium trust. Medium trust still provides a constrained environment for isolating applications from one another and from shared server resources. Medium trust applications have no registry access, no event log access, and no ability to use reflection. Web access is limited to the network address that you define in the &lt;&lt;trust/&gt;&gt; element, and file system access is limited to the application's virtual directory hierarchy. If medium trust policy is too restrictive, you can create and use a custom policy file.

      更多内容见链接http://msdn.microsoft.com/en-us/library/ff648344.aspx

      【讨论】:

        猜你喜欢
        • 2013-01-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-22
        • 1970-01-01
        • 2010-11-30
        • 2012-06-18
        • 2010-09-23
        相关资源
        最近更新 更多