在同一个Azure Web App

时间:2016-01-14 04:06:08

标签: azure asp.net-core azure-web-app-service

我看过这个问题: Publish WebAPI and MVC projects to same Azure Web Site?

但它并没有适用于"二级"应用

从中我了解了Azure Web应用程序服务(以前称为Azure网站)中的虚拟目录。

我正在尝试部署到相同的Azure Web应用程序2 Web应用程序中。在名为MyOAuth的解决方案下,两者都是ASP.NET 5应用程序(它们将是MVC 6):

  • MyApi:应通过 myoauth.azurewebsites.com
  • 访问的ASP.NET 5应用程序
  • MyAuth:应通过 myoauth.azurewebsites.com/oauth
  • 访问的ASP.NET 5应用程序
Solution 'MyOAuth'
  |-src
     |- MyApi
     |- MyAuth

因此,在我创建的Azure Web App服务中(也称为 MyOAuth ),在设置下我有以下虚拟应用程序和目录:

/        site\wwwroot         Application
/oauth   site\wwwroot\oauth   Application

Visual Studio 2015的发布连接是:

  • MyApi
Server: myoauth.scm.azurewebsites.net:443
Site Name: MyOAuth
User Name: *****
Password: ****
Destination URL: http://myoauth.azurewebsites.net
  • MyOAuth
Server: myoauth.scm.azurewebsites.net:443
Site Name: MyOAuth/oauth
User Name: *****
Password: ****
Destination URL: http://myoauth.azurewebsites.net/oauth

这些是两个项目的启动配置:

MyApi的Startup.cs

//...
public void Configure(IApplicationBuilder app)
{
    app.UseIISPlatformHandler();
    app.Run(async (context) =>
    {
        await context.Response.WriteAsync("Hello MyApi app");
    });
}

MyAuth的Startup.cs

//...
public void Configure(IApplicationBuilder app)
{
    app.UseIISPlatformHandler();
    app.Run(async (context) =>
    {
        await context.Response.WriteAsync("...And hello MyAuth app");
    });
}

发布后,当我访问http://myoauth.azurewebsites.net时,我得到了正确的回复Hello MyApi app,但在请求http://myoauth.azurewebsites.net/oauth时,我收到服务器500错误,文字为The page cannot be displayed because an internal server error has occurred.

我设法从Azure LogFiles文件夹中检索以下DetailedError:

  

HTTP错误500.19 - 内部服务器错误请求的页面不能   访问,因为页面的相关配置数据是   无效。

     

详细错误信息:模块IIS Web Core   通知BeginRequest   处理程序尚未确定   错误代码0x800700b7   配置错误无法添加类型'添加'的重复集合条目。   具有唯一键属性' name'设置为' httpplatformhandler'配置   文件\?\ D:\ home \ site \ wwwroot \ oauth \ web.config请求的URL
  http://MyOAuth:80/oauth物理路径D:\ home \ site \ wwwroot \ oauth   登录方法尚未确定登录用户尚未确定

     

配置来源:

<handlers>
  <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>

有人可以就此提出建议或者给我一个如何在同一个Azure Web App服务下运行2个不同的ASP.NET 5应用程序的解决方案吗? 谢谢!

1 个答案:

答案 0 :(得分:2)

可能遵循此处概述的文件夹结构:

https://github.com/aspnet/dnx/issues/928#issuecomment-171617386

问题在于我还没有找到能够轻松使用vs2015或VSTeamServices的工具

我必须做的一件关键事情才能使它工作(仍然做了一些手动部署步骤 - 但我发现我的设置中的一个问题也可以帮助你,我想)。以下将修复500.19错误

    <handlers>
      <remove name="httpplatformhandler" />
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>

有关同一主题的更多信息,请访问:Deploying aspnet5 apps to virtual directories on azure websites

相关问题