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

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

问题描述

我使用 Visual Studio 2015 在 asp.net 核心版本 1.0.1 中开发了一个 web api,当我在开发它的同一台电脑的 IIS 10 中发布 web api 时,一切正常.当我将web api的发布文件夹复制并粘贴到不同的PC时出现问题,浏览器显示错误500.19 Internal Server Error,错误代码0x8007000d,请求的页面无法访问,因为页面的相关配置数据无效",这会导致 web.config 中出现一些问题.我不认为 IIS 的版本是问题,因为从 IIS 10 移动到 IIS 8 或从 IIS8 移动到 IIS 10 会出现相同的错误,并且在两台装有 IIS 10 的电脑之间也会发生同样的错误.我已经回顾了几个相关的问题,例如,元素'系统.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=".logsstdout" 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=".uildingSecureWebApi.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" 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".

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

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 Core Windows Server 托管包
  • 您可能还想验证 dotnet 可执行文件的路径是否存在于部署计算机的环境变量中.要检查这一点,首先要找到 dotnet.exe 的安装路径.它通常位于 C:Program FilesdotnetC: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 Filesdotnet 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 服务器后,在 IIS 中发布的 asp.net core web api 给出错误 500.19 (0x8007000d)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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