首页 > 解决方案 > 如何更改 Asp.Net Core 3.1 web.config 文件中的默认信任设置?

问题描述

我在托管公司提供的服务器上部署了我的 Asp Net Core 3.1 项目。首先,我的项目没有问题,但我的托管公司更改了 IIS 安全选项。完全信任选项转换为。之后,当我进入我的网站时,我得到500 Internal Server Error。我能做些什么?如何更改默认的 Asp Core Trust 选项?

错误:

HTTP 错误 500.19 - 内部服务器错误

无法访问请求的页面,因为该页面的相关配置数据无效。

<?xml version="1.0" encoding="utf-8"?>
<location path="." allowOverride="true">
        <system.web>
        <securityPolicy>
            <trustLevel name="Full" policyFile="internal" />
            <trustLevel name="High" policyFile="web_hightrust.config" />
            <trustLevel name="Medium" policyFile="web_mediumtrust.config" />
            <trustLevel name="Low" policyFile="web_lowtrust.config" />
            <trustLevel name="Minimal"
                        policyFile="web_minimaltrust.config" />
        </securityPolicy>
        <trust level="Medium" originUrl="" />
    </system.web>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
        </handlers>
        <aspNetCore processPath=".\admin.exe" arguments="" stdoutLogEnabled="false" hostingModel="InProcess" stdoutLogFile=".\logs\stdout">
            <environmentVariables>
                <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
            </environmentVariables>
        </aspNetCore>
        <!-- maxAllowedContentLength = 1GB (the value is in Bytes) -->
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="1073741824" />
            </requestFiltering>
        </security>
    </system.webServer>
</location>

编辑

你好,我们又见面了。一天后,当我进入网站时,我看到我的问题解决了。为什么?真的,我不知道:)

标签: asp.netasp.net-mvcasp.net-core

解决方案


推荐阅读