我是 .NET Core 的新手,这是我第一次尝试部署其中的一个。
该项目是我正在构建的 Angular 前端的 API,它接受 HTTP 请求并返回 JSON。当我在我的机器上的 Visual Studio 中运行它时,一切都很好。我正在运行 VS2017 并安装了 .NET Core 2.0.0。
我发布到 Web 服务器上的一个文件夹,它似乎一切正常,但是当我尝试访问 API 时,我收到 404 not found 错误。服务器正在运行 .NET 2.0.6(我试图获得 2.0.0,但在 Hosting Bundle Installer 中找不到它。
如果我删除 web.config,HTML 文件就会显示出来,但显然 API 不起作用。但随着 HTML 文件的显示,权限和访问权限没有问题。事件查看器中没有任何内容。我也试过在 web.config 中打开日志记录,但它没有记录......可能还不够。
Web 配置看起来像这样。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\RawMaterialsSystem.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: f01b1621-2ced-4ad2-9ae6-004e03b0e043-->`
第 1 步:将您的 web.config 文件更改为此
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<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>
第2步:
第 3 步:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句