[转].Net Core Web应用发布至IIS后报“An error occurred while starting the application”错误
本文转自:http://www.cnblogs.com/TomGui/p/6438686.html
An error occurred while starting the application.
.NET Core X64 v4.1.1.0 | Microsoft.AspNetCore.Hosting version 1.1.0-rtm-22752 | Microsoft Windows 6.3.9600
报这个错,一脸懵逼,环境都按官方文档配置正确了,怎么办?
1.修改web.config文件,stdoutLogEnabled改为true,如下:
<aspNetCore processPath="dotnet" arguments=".\Dialysis.WebApi.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
补充一点,这个文件是在发布之后的文件里,如果没有单独配置发布文件。
就在\bin\Debug\netcoreapp1.1 里面,在根目录下有web.config文件。
注: 不在源文件的根目录下面。
另外,需要手动建 这个 logs 文件夹,因为iis不会给你自动创建。
我出这个问题的原因也是因为项目在startup的时候没有读到 nlog.config这个文件导致的错误。
在开发环境中,把这个文件的属性配置成“复制到输出目录:始终复制” 和 “生成操作:内容” 就可以了。
2.再次打开网站,还是报上述错误,别急,查看发布根目录发现多了一个Logs文件夹,打开里面的stdout_xxx.log文件
Application startup exception: System.IO.FileNotFoundException: Could not find file 'G:\FTP\DialysisWebApi\Dialysis.WebApi.xml'. File name: 'G:\FTP\DialysisWebApi\Dialysis.WebApi.xml' at System.IO.Win32FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent) at System.IO.Win32FileSystem.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Xml.XmlSystemPathResolver.GetEntity(Uri uri, String role, Type typeOfObjectToReturn) at System.Xml.XmlTextReaderImpl.FinishInitUriString() at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver) at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) at System.Xml.XmlReader.Create(String inputUri) at System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions.<>c__DisplayClass24_0.<IncludeXmlComments>b__0() at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions.CreateSwaggerProvider(IServiceProvider serviceProvider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider) at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass3_0.<UseMiddleware>b__0(RequestDelegate next) at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() Hosting environment: Production Content root path: G:\FTP\DialysisWebApi Now listening on: http://localhost:22365 Application started. Press Ctrl+C to shut down.
发现缺少文件,把文件复制到发布根目录下就解决了
发布至IIS微软官方文档
[转].Net Core Web应用发布至IIS后报“An error occurred while starting the application”错误的更多相关文章
- .Net Core Web应用发布至IIS后报“An error occurred while starting the application”错误
An error occurred while starting the application. .NET Core X64 v4.1.1.0 | Microsoft.AspNetCore ...
- asp.net core web api 发布到iis失败 错误500.19
找了很久,发现是没有装DotNetCore.2.0.0-WindowsHosting.exe的原因. 还是官方文档最给力.部署时遇到问题的朋友可以参考官方文档 https://docs.microso ...
- ASP.NET Core Web 项目 发布的IIS7提示“HTTP Error 502.5 - Process Failure
原因就是NUGET引用的DLL和SDK的版本不对, 你打开CMD,在项目bin目录运行dotnet xxx.dll, 会看到具体错误信息 所以你要么引用低版本的dll,要么升级最新SDK
- 发布tomcate时报A configuration error occurred during startup.please verify the preference field with the prompat:null
发布tomcate时报A configuration error occurred during startup.please verify the preference field with the ...
- asp.net core 2.0发布到IIS报错解决方案
大体来说,是环境的问题. 第一个错误,如图: 1. 查了网上说是文件夹权限的问题,依次设置了Everyone权限和IIS_IUSER权限,能勾选的都勾选了,然而并没有什么用,看来不是这个问题导致的. ...
- asp.net core 2.0发布到IIS流程及报错解决方案
我这是个新装的服务器,没有安装任何软件. 一.发布流程 1.安装AspNetCoreModule托管模块,同时会自动安装..net core runtime DotNetCore.2.0.8-Wi ...
- 将.NET Core Web Api发布到Linux(CentOS 7 64)
将.NET Core(2.1) Web Api发布到Linux(CentOS 7 64) 近来在学习linux相关的一些东西,然后正巧想试一下把core的应用程序发布到Linux,毕竟跨平台.尝试一下 ...
- .net core 发布到iis问题 HTTP Error 500.30 - ANCM In-Process Start Failure
1. 没有在Program里配置IIS webBuilder.UseIIS(); 2. StartupProduction 里AutoFac容器注入错误和新版的CORS中间件已经阻止使用允许任意Ori ...
- SlickUpload 发布到IIS后报错
开发时候采用slickupload控件都没问题,项目发布到IIS时发生了错误: Could not contact SlickUpload request progress handler at /S ...
随机推荐
- 异步编程async/await
什么是异步? 在异步程序中,程序代码不需要按照编写时的顺序严格执行,有时需要一在一个新的线程中运行一部分代码,有时无需创建新的 线程,但是为了更好的利用单个线程的能力,需要改变代码的执行顺序. 进程 ...
- boost::string 例题1
如果有一个语法正确的shader源文件,其包括若干关于uniform变量的定义.请写一个程序从某个shader源文件里提取其全部定义的uniform变量.要求记录其名称.数据类型和初始值(如果有定义) ...
- jqGrid-基础篇
jqGrid 是一个用来显示网格数据的jQuery插件,通过使用jqGrid可以轻松实现前端页面与后台数据的ajax异步通信. 一.jqGrid特性 基于jquery UI主题,开发者可以根据客户要 ...
- NSCharacterSet 关于字符串编码
此文转自:http://nshipster.cn/nscharacterset/ 只为个人为了查找问题方便才复制过来的....... 正如之前提前过的,基础类库(Foundation)拥有最好的.功能 ...
- Setup "EQGRP_Lost_in_Translation" Of NAS
Setup "EQGRP_Lost_in_Translation" Of NAS 1.前言: 北京时间4月14号晚,TheShadowBrokers在steemit.com博客上放 ...
- Docker安装Odoo实现快速迁移(四)
一. 安装postgres数据库 root@ubuntu-:~# docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --nam ...
- 05. flex元素水平垂直居中(三种position水平垂直居中和两种新老版本水平垂直居中)
flex元素水平垂直居中(三种position水平垂直居中和两种新老版本水平垂直居中) (1).position : <!DOCTYPE html> <html lang=" ...
- springcloud(三)-Eureka
Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...
- Locust源码目录结构及模块作用
Locust源码目录结构及模块作用如下: 参考文章:https://blog.csdn.net/biheyu828/article/details/84031942
- python计算π及进度条显示
今天老师布置了一个课后作业,去尽可能的准确计算π的值,还要显示时间和进度条,对于python小白的我,当然是综合书上和网上的知识,自己做了一个小程序,代码如下: 一.写代码的准备工作:用pip下载第三 ...