【发布时间】:2017-12-27 10:18:40
【问题描述】:
我有一个 .net 核心 web api 应用程序,在 localhost 上,它在 iis express 和默认 iis 上都运行良好。在我的 Web 服务器上,我想将我的应用程序托管为 Asp.Net v4.0 应用程序下的子应用程序。我创建了一个子应用程序并部署了我的核心应用程序,然后创建了一个no managed 应用程序池并为我的网络核心子应用程序选择了这个应用程序池。我已经完全安装了 .net core 2.0 windows hosting bundle 和 .net core 2.0 SDK。
Web.config
<?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=".\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
StartUp类'Configure方法
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger)
{
logger.AddFile(Configuration.GetValue<string>("LogPath"));
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyAppV1");
});
app.UseMvc();
//app.UseMiddleware<LoggingMiddleWare>();
}
程序.cs
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
所以当我从 api 调用端点时,它返回 500 Internal server error。
尽管我的 stdoutlog 已启用,但没有创建任何日志文件,也看不到任何正确的事件日志。
【问题讨论】:
-
docs.microsoft.com/en-us/aspnet/core/publishing/iis 的 IIS 配置、疑难解答提示和常见错误部分你看过了吗?
-
@MartinUllrich 我按照本文档的说明进行操作,但是,关于将 .net 核心应用程序作为 .net 4.0 应用程序池下的子应用程序托管的信息非常有限,此信息为 here,它只显示日志配置,我无法知道我正在做的事情是否可行或如何克服我的错误。
标签: c# iis .net-core asp.net-core-2.0