我有一个基于asp.net core 2.0的应用程序。当我尝试在Visual Studio 2017中将其作为项目运行时,一切正常,但是当我发布并尝试通过命令提示符或IIS托管运行它时-该程序有效,甚至提供了一些日志,但网站无法正常工作当我尝试访问它时,出现404错误。可能是什么问题?
这是我在命令提示符下得到的输出:
E:\ Projects \ DotNet \ PublishTEST> dotnet。\ RSSAggr
托管环境:生产
内容根路径:E:\ Projects \ DotNet \ PublishTEST
应用程序已启动。按Ctrl + C关闭。
Program.cs
public class Program
{
public static void Main(string[] args)
{
var host = BuildWebHost(args);
using (var scope = host.Services.CreateScope())
using (var context = scope.ServiceProvider.GetService<AppDbContext>())
{
context.Database.EnsureCreated();
}
host.Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
appsettins.json
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\RSSAggregator.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>