在IIS中发布的asp.net核心web api移动到不同的IIS服务器pc后给出错误500.19 [英] asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19

查看:319
本文介绍了在IIS中发布的asp.net核心web api移动到不同的IIS服务器pc后给出错误500.19的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用visual studio 2015在asp.net核心版本1.0.1中开发了一个web api,当我在开发它的同一台PC的IIS 10中发布web api时,一切正常。当我将web api的发布文件夹复制并粘贴到另一台PC时出现问题,浏览器显示错误500.19内部服务器错误,错误代码0x8007000d,由于页面的相关配置数据,无法访问请求的页面无效,这导致web.config中的一些问题。
我不认为IIS的版本是问题,因为从IIS 10迁移到IIS 8或从IIS8迁移到IIS 10会产生相同的错误,并且在使用IIS 10的两台PC之间也会发生同样的错误。
I已经审查了几个相关问题,例如元素'系统。 webServer'具有无效的子元素'aspNetCore',以及其他与web.config文件相关的文件,其中似乎找到了错误。开发环境中的web.config文件是:

I developed a web api in asp.net core version 1.0.1 using visual studio 2015, when I published the web api in IIS 10 of the same pc where it was developed, everything works correctly. The problem arises when I copy and paste the publication folder of the web api to a different pc, the browser shows the error 500.19 Internal Server Error, error code 0x8007000d, "The requested page can not be accessed because the related configuration data for the page is invalid ", which leads to some problem in the web.config. I do not think the version of IIS is the problem because moving from IIS 10 to IIS 8 or from IIS8 to IIS 10 gives the same error, and the same happens between two pcs with IIS 10. I have already reviewed several related issues, like, The element 'system.webServer' has invalid child element 'aspNetCore', and others related to web.config file where it seems the error is found. The web.config file in the development environment is:

<?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" forwardWindowsAuthToken="false"/>
     </system.webServer>
    </configuration>

发布web api后,web.config文件如下所示:

After publish the web api, the web.config file looks like:

<?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="dotnet" arguments=".\buildingSecureWebApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
 </system.webServer>
</configuration>

无论发布什么计算机,此web.config文件都具有相同的内容。

This web.config file has the same content no matter what computer was publish.

我的问题的解决方案可能是什么,我需要在任何版本的Windows中安装web api,直到现在它只能在开发的pc上正常工作。

Some idea of ​​what the solution to my problem may be, I need to mount the web api in any version of windows and until now it only works correctly on the pc that was developed.

推荐答案

要获得更详细的错误消息:


  1. 验证日志目录是否存在于Web配置引用的路径中。如果没有,请创建它。配置中显示的路径会将logs目录放在已部署站点的根文件夹中。

  1. Verify that the log directory exists at the path referenced by the web config. If it does not, create it. The path shown in your config would place the "logs" directory in the root folder of the deployed site.

验证应用程序池是否具有写入权限日志目录和

Verify that the application pool has write access to the logs directory and

验证`stdoutLogEnabled =true。

Verify that `stdoutLogEnabled="true".

如果您已经验证了所有这三个项目,那么您应该获得包含更详细描述的日志条目错误

If you have verified all 3 of these items, then you should get log entries that will contain a more detailed description of the error

什么可能导致500.19内部服务器错误,错误代码0x8007000d错误?


  • .NET Core托管软件包未安装在部署站点的Web服务器上。要解决此问题,请获取此下载 .NET核心Windows服务器托管软件包

  • 您可能还需要验证部署计算机环境变量中是否存在dotnet可执行文件的路径。要检查这一点,首先要找到安装dotnet.exe的路径。它通常位于 C:\Program Files \dotnet C:\Program Files(x86)\dotnet 。知道路径后,请确保环境变量中存在路径。

  • .NET Core hosting bundle is not installed on the webserver where the site is deployed. To remedy this, obtain this download .NET Core Windows Server Hosting bundle
  • You may also want to verify that the path to the dotnet executable exists in the deployment machine's environment variables. To check this, first find the path where dotnet.exe is installed. It is generally located in either C:\Program Files\dotnet or C:\Program Files (x86)\dotnet. Once you know the path, ensure that the path exists in your Environment Variables.

控制面板>系统>高级系统设置>环境变量。突出显示路径,单击编辑并验证是否存在dotnet文件夹的路径。如果不是,请添加它。对用户变量和系统变量执行相同的操作。重新启动计算机,然后重试。

Control Panel > System > Advanced System Settings > Environment Variables. highlight "Path", click 'Edit' and verify that the path to the dotnet folder is present. If it isn't, add it. Do the same for both the User variables and System variables. Restart your machine and try again.

这篇关于在IIS中发布的asp.net核心web api移动到不同的IIS服务器pc后给出错误500.19的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆