html - 如何设置 Web.config:MVC
问题描述
当我尝试访问使用 MVC 构建的网站时,遇到错误 500。我联系了我的托管服务提供商,他们说问题出在我的 web.config 文件上。问题是当我通过 Visual Studio 创建项目时,项目中没有。
我按照本指南添加了一个:如何:创建 Web.config 文件。这是由微软提供的。
我在这里完全不知所措,因为我不知道需要什么样的信息或如何配置它才能工作。
这些是文件的当前内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<!--
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
-->
</configuration>
我要的是一些关于我需要做什么的方向,以及为什么这不包括在网站上。
解决方案
您需要与您的提供商澄清他们是否支持 asp.net 核心,因为它有自己的运行时库。
此外,web.config 与经典的 ASP.NET 框架相关,而不是与 ASP.NET Core 相关。尝试在 Visual Studio 中使用任何 .NET 版本 4.x 创建应用程序。在模板中,您将看到 web.config。
如果您仍想使用 .net 核心,它使用稍微不同的配置机制。您可以在 asp.net core 的www.asp.net教程部分阅读更多信息
推荐阅读
- javascript - 在自动完成列表中使用向上和向下键滚动
- xml - XSLT:在 for-each 中使用 if 有异常
- python - 在 Windows10 32bit Python3 中安装 PyQt5
- excel - Power BI:折线图上的最小值/最大值,值选项卡上没有第二个实例
- node.js - Sinon Fake Timer 在测试中多次调用仅触发一次
- xml - xslt 替换一个节点
- javascript - 开玩笑的异步测试忽略了expect()函数
- reporting-services - SSRS 在导出为 CSV 时添加额外字符
- python - Python删除停用词(熊猫数据框):输出与输入相同
- c# - 替换为