在虚拟目录Azure的多个站点(Azure multiple sites in virtual di

2019-09-28 18:18发布

我有我需要在同一个域中部署3个asp.net核心站点(子域不会与我的SSL证书的工作)。

  • https://my-site.com (单页的应用程序)
  • https://my-site.com/api (网页API)
  • https://my-site.com/identity (标识服务器)

当我部署API和身份项目,他们工作得很好。 但是,在部署的单页的应用程序,API和身份停止工作时。

The page cannot be displayed because an internal server error has occurred.

所以它可能是从启动我想没有早期即刻出现错误。 单页的应用程序工作正常。

看来,水疗中心的干扰,我试图解决方案在这里忽略的路线,但我得到了同样的错误。

我曾尝试解决这里得到一个更具描述性的错误,但无济于事。

不知道在哪里何去何从

Answer 1:

这个问题的原因是,无论是根应用程序和孩子应用添加aspNetCore处理程序,导致系统配置炸毁。 您可以通过在Azure门户打开详细的错误信息 ,然后根据发现的错误页面看到这个D:\home\LogFiles\DetailedErrors 。 你会看到这样的错误:

无法添加类型的重复的集合项“添加”具有独特的键属性“名”设置为“aspNetCore”

有两种方法来解决这个。

第一种是使用location标记,以防止继承。 具体来说,你的根应用程序的改变web.config从这样的事情:

<?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=".\myapp.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
  </system.webServer>
</configuration>

对这样的事情:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\myapp.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
    </system.webServer>
  </location>
</configuration>

第二种方法是,以除去<handlers> -application部分,以避免重复(如在建议的文档 的子应用程序配置下):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <aspNetCore processPath="dotnet" arguments=".\mySubApp.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
  </system.webServer>
</configuration>


文章来源: Azure multiple sites in virtual directories