zoukankan      html  css  js  c++  java
  • .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.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=".logsstdout" />

    2.再次打开网站,还是报上述错误,别急,查看发布根目录发现多了一个Logs文件夹,打开里面的stdout_xxx.log文件

    Application startup exception: System.IO.FileNotFoundException: Could not find file 'G:FTPDialysisWebApiDialysis.WebApi.xml'.
    File name: 'G:FTPDialysisWebApiDialysis.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:FTPDialysisWebApi
    Now listening on: http://localhost:22365
    Application started. Press Ctrl+C to shut down.

    发现缺少文件,把文件复制到发布根目录下就解决了

    发布至IIS微软官方文档

  • 相关阅读:
    电脑开机自动上线(电脑开机之后自动将电脑的远程端口映射到服务器,可以通过其他设备进行连接,实现随时访问自己的电脑)
    批处理(bat)用来监测Windows网络状态脚本
    js取消点击事件
    uni-app 几个实用的功能
    前端几个比较方便的正则验证
    element.ui时间选择器
    Vue pc端项目打包后在nginx中无法正常浏览,点击页面出现404
    微信小程序之选项卡的实现方法
    文本溢出显示省略号
    分享几道前端面试题(3)
  • 原文地址:https://www.cnblogs.com/TomGui/p/6438686.html
Copyright © 2011-2022 走看看