在同一个Azure Web App下运行两个不同的ASP.NET 5应用程序 [英] Run two different ASP.NET 5 applications under the same Azure Web App
问题描述
我看了这个问题: 将WebAPI和MVC项目发布到同一Azure网站吗?/a>
I have had a look at this question: Publish WebAPI and MVC projects to same Azure Web Site?
但是对于辅助"应用程序,它不能正常工作.
but it doesn not work properly for the "secondary" application.
然后,我了解了Azure Web应用程序服务(以前称为Azure网站)中的虚拟目录.
and from that I learned about virtual directories in Azure web app services ( previously called Azure websites).
我正在尝试将2个Web应用程序部署到相同的Azure Web应用程序中.两者都是在名为MyOAuth的解决方案下的ASP.NET 5应用程序(它们将是MVC 6):
I am trying to deploy into the same Azure web apps 2 web applications. Both are ASP.NET 5 applications (they will be MVC 6) under a solution called MyOAuth:
- MyApi:应该可以通过 myoauth.azurewebsites.com 访问的ASP.NET 5应用程序
- MyAuth:应通过 myoauth.azurewebsites.com/oauth 访问的ASP.NET 5应用程序
- MyApi: ASP.NET 5 application that should be accessible through myoauth.azurewebsites.com
- MyAuth: ASP.NET 5 application that should be accessible through myoauth.azurewebsites.com/oauth
Solution 'MyOAuth'
|-src
|- MyApi
|- MyAuth
因此,在我创建的Azure Web App服务(也称为 MyOAuth )中,在设置下,我具有以下虚拟应用程序和目录:
So in the Azure Web App service that I have created (called also MyOAuth), under settings I have the following Virtual Applications and Directories:
/ site\wwwroot Application
/oauth site\wwwroot\oauth Application
Visual Studio 2015的发布连接都为:
The Publish connection from Visual Studio 2015 for both of them are:
- 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
这是两个项目的启动配置:
These are the Startup configuration for both projects:
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.
After publishing, when I access http://myoauth.azurewebsites.net I get the proper response Hello MyApi app
, but when requesting http://myoauth.azurewebsites.net/oauth I get a server 500 error with text The page cannot be displayed because an internal server error has occurred.
我设法从Azure LogFiles文件夹中检索以下DetailedError:
I managed to retrieve the following DetailedError from the Azure LogFiles folder:
HTTP错误500.19-内部服务器错误请求的页面不能为 由于该页面的相关配置数据为 无效.
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
详细的错误信息:模块IIS Web核心
通知BeginRequest
处理程序尚未确定
错误代码0x800700b7
配置错误无法添加类型为添加"的重复收集条目
唯一键属性名称"设置为"httpplatformhandler"的配置
文件\?\ D:\ home \ site \ wwwroot \ oauth \ web.config请求的URL
http://MyOAuth:80/oauth 物理路径D:\ home \ site \ wwwroot \ oauth
登录方式尚未确定登录用户尚未确定
Detailed Error Information: Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x800700b7
Config Error Cannot add duplicate collection entry of type 'add'
with unique key attribute 'name' set to 'httpplatformhandler' Config
File \?\D:\home\site\wwwroot\oauth\web.config Requested URL
http://MyOAuth:80/oauth Physical Path D:\home\site\wwwroot\oauth
Logon Method Not yet determined Logon User Not yet determined
配置源:
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
请问对此有何建议或给我一个解决方案,以解决如何在同一Azure Web App Service下运行2个不同的ASP.NET 5应用程序的问题? 谢谢!
Could anybody advise on this or give me a solution on how to run 2 different ASP.NET 5 applications under the same Azure Web App Service, please? Thank you!
推荐答案
可以按照此处概述的文件夹结构进行操作:
Its possible following the folder structure outlined here:
https://github.com/aspnet/dnx/issues/928 #issuecomment-171617386
问题是我还没有找到可以轻松使用vs2015或VSTeamServices的工具
THe problem is that I have yet not found tooling that makes it easy to do with vs2015 or VSTeamServices
要使其正常运行,我必须要做的关键事情之一(仍然进行了一些手动部署步骤-但我发现我的设置中有一个问题对我也有帮助).以下内容将修复500.19错误
One of the key things that I had to do to make it work (still did some manual deployments steps - but i found one issue in my setup that could help you also i think). The following will fix the 500.19 error
<handlers>
<remove name="httpplatformhandler" />
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
More information on same topic can be found at: Deploying aspnet5 apps to virtual directories on azure websites
这篇关于在同一个Azure Web App下运行两个不同的ASP.NET 5应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!