ASP.NET Core RESTfull API托管 - 500内部服务器错误

时间:2017-09-13 21:44:35

标签: asp.net asp.net-core web-hosting internal-server-error

According to this topic我正在尝试发布和托管我的.NET Core应用程序。当我尝试使用来自我的API(example.com/pets/users)的GET请求检索数据时,我收到500内部服务器错误。 example.com/pets是我的API发布的网址。

我的webconfig看起来像这样:

<?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=".\Pets.Api.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>

我相信这很好。

stdout log说明了这个:

  

警告:   Microsoft.Extensions.DependencyInjection.DataProtectionServices [59]

     

用户个人资料和HKLM注册表都不可用。使用临时密钥存储库。受保护的数据将无法使用   申请退出。

     

警告:   Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository [50]

     

使用内存存储库。密钥不会持久存储。

     

托管环境:生产

     

内容根路径:D:\ HostingSpaces \ xardaslord \ example.com \ wwwroot \ pets

     

现在聆听:http://localhost:13556

     

申请已开始。按Ctrl + C关闭。

到底出了什么问题?我对远程数据库连接进行了解决,这是正确的。

如果有人能帮到我,我真的很感激。

2 个答案:

答案 0 :(得分:2)

上述警告错误的解决方法:编辑IIS应用程序池以启用用户配置文件加载。应用程序池&gt;高级设置&gt;加载用户个人资料:True

答案 1 :(得分:0)

我解决了这个问题。问题是我在服务器上新创建的虚拟目录上发布了该API。当我在子域上发布API时,一切正常。