Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion] Deployment of ASP.NET 2.0.8 and .NET Core 2.1.0-rc1 to Azure App Service #47

Closed
watashiSHUN opened this issue May 11, 2018 · 22 comments

Comments

@watashiSHUN
Copy link

Discussion issue for the Deployment of ASP.NET 2.0.8 and .NET Core 2.1.0-rc1 to Azure App Service
Azure/app-service-announcements#107

@davidebbo
Copy link
Contributor

The deployment is now complete.

@saxx
Copy link

saxx commented May 15, 2018

Where can I find information about deployment to Azure Germany?

@chrisgbaker
Copy link

Does this include both x86 and x64 runtimes?

@watashiSHUN
Copy link
Author

it currently only has x86, but we are working on x64

@chrisgbaker
Copy link

Thanks for the info. Is there a timeline for x64? I haven't been able to successfully release an app targeting 2.1.300-rc1-008673 in azure (or preview releases for that matter), but at least having x64 support will help eliminate some variables. Currently our apps are being built via our agents with the x64 sdk, and we are trying to deploy to either 32 or 64 bit at this point.

@chrisgbaker
Copy link

Also, I've removed all extensions from the site slot. Is this now the approach, or do some still need to be installed?

@davidebbo
Copy link
Contributor

Right, you don't need extensions for RC1. There is no exact ETA for 64 bit. In the meantime, you can just do a self-contained deployment.

@chrisgbaker
Copy link

@davidebbo, that doesn't seem to work either, and at this point I don't know what is wrong / misconfigured.

My csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
    <GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
    <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Local|AnyCPU'" />

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='QA|AnyCPU'" />

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DocumentationFile>bin\Debug\netcoreapp2.1\TestDelivery.API.xml</DocumentationFile>
    <NoWarn>1701;1702;1705;1591</NoWarn>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DocumentationFile>bin\Release\netcoreapp2.1\TestDelivery.API.xml</DocumentationFile>
    <NoWarn>1701;1702;1705;1591</NoWarn>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.6.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0-beta2" />
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-rc1-final" />
    <PackageReference Include="Microsoft.AspNetCore.AzureAppServicesIntegration" Version="2.1.0-rc1-final" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="2.4.0" />
  </ItemGroup>
  <ItemGroup>
    <WCFMetadata Include="Connected Services" />
  </ItemGroup>
  <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
    <Exec Command="..\..\GitVersion.Portable\GitVersion.exe /updateassemblyinfo .gitversion.cs /ensureassemblyinfo" />
  </Target>
</Project>

My app settings for this slot:
image

The output of dotnet --info:

D:\home>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300-rc1-008673
 Commit:    f5e3ddbe73

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x86
 Base Path:   D:\Program Files (x86)\dotnet\sdk\2.1.300-rc1-008673\

Host (useful for support):
  Version: 2.1.0-rc1
  Commit:  eb9bc92051

.NET Core SDKs installed:
  1.1.7 [D:\Program Files (x86)\dotnet\sdk]
  1.1.8 [D:\Program Files (x86)\dotnet\sdk]
  2.1.4 [D:\Program Files (x86)\dotnet\sdk]
  2.1.101 [D:\Program Files (x86)\dotnet\sdk]
  2.1.300-rc1-008673 [D:\Program Files (x86)\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0-rc1-final [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0-rc1-final [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.9 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.10 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.6 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.7 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-rc1 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

D:\home> 

The web.config at wwwroot (there are two, as root is set up to serve static files:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect-to-http" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" negate="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTPS}" pattern="off" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
        </rule>
        <rule name="wwwroot-static" enabled="true">
          <match url="^(?!/api/api-docs)([\S]+[.](html|htm|svg|js|css|png|gif|jpg|jpeg|json))" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_URI}" pattern="swagger.json" negate="true" />
          </conditions>
          <action type="Rewrite" url="/{R:1}" />
        </rule>
        <rule name="Test-Delivery-Html5-Routes" enabled="true" stopProcessing="true">
          <match url="(?!api/).*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="api" negate="true" />
          </conditions>
          <action type="Rewrite" url="/index.html" />
        </rule>
        <rule name="empty-root-index" enabled="true" stopProcessing="true">
          <match url="^$" />
          <action type="Rewrite" url="/index.html" />
        </rule>
      </rules>
    </rewrite>
    <handlers>
      <!--
      These may need to be revisited if we begin serving assets from Kestrel, but for now, all we return is JSON. 
          IIS is already handling the Swagger static files, as well as app.js

      <add name="StaticFileModuleHtml" path="*.htm*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleSvg" path="*.svg" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleJs" path="*.js" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleCss" path="*.css" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleJpeg" path="*.jpeg" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleJpg" path="*.jpg" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />      
      <add name="StaticFileModuleGif" path="*.gif" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      -->
      <add name="SwaggerFileModulePng" path="api/api-docs/images/logo_small.png" verb ="*" modules="AspNetCoreModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModulePng" path="*.png" verb ="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleHtml" path="index.html" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleJS" path="app.js" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleSilentHtml" path="silent-renew.html" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
      <add name="StaticFileModuleSilentJS" path="silent-renew.js" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
    </handlers>
    <urlCompression doStaticCompression="true" doDynamicCompression="true" />
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
    </httpCompression>
  </system.webServer>
</configuration>

global.json:

{
  "sdk": {
    "version": "2.1.300-rc1-008673"
  }
}

the web.config where the dotnet project is being hosted (under wwwroot/api):

<?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=".\TestDelivery.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: 68AE44A6-B349-457D-811D-8DF5FF6787BD-->

And at this point, The error I'm seeing fairly consistently is The specified CGI application encountered an error and the server terminated the process.. However, my app actually runs every now and then. If you hit https://qa-test-delivery-scratch.oasys.one/api/info/version, sometimes this will produce the correct json response.

In between pushing the release I've also tried the advice to delete the wwwroot folder via kudu, but that has no affect.

@davidebbo
Copy link
Contributor

@chrisgbaker Simplest way to convey your issue is to share a minimal repo. Also, first try whether everything works for you with a vanilla new app. If that doesn't, then the specifics of your ap become irrelevant.

@chrisgbaker
Copy link

Kind of difficult when the issue isn't the repo; everything runs fine locally regardless of any of this. The issue is deploying to azure. Any advice in being able to more clearly convey issues when the App Service is part of the problem?

@davidebbo
Copy link
Contributor

@chrisgbaker Please see the link I pointed to above. The whole idea is to share a repo such that if we deploy it to Azure, we observe the same thing that you observe. This makes it far easier than trying to make sense of snippets, and it makes sure that we are trying exactly the same thing.

@chrisgbaker
Copy link

https://github.com/chrisgbaker/azure_app_service_failure
@davidebbo Here is another project that is almost bare-bones that will not start in the App Service but will run locally.

@chrisgbaker
Copy link

Also, in that project I am targeting preview2 still, but changing to rc1 and modifying two lines of code to use Groups.AddToGroupAsync still refuse to start.

@davidebbo
Copy link
Contributor

Thanks, we'll try to set up a repro. Are you trying to use the RC1 x86 that's on the box, or are you doing self-contained deployment (or have you tried both)?

@nsp5074
Copy link

nsp5074 commented May 22, 2018

@davidebbo any update on this? having the same issues (self contained or otherwise)

@davidebbo
Copy link
Contributor

@npasqua I was waiting to hear back on the specific scenario. What do you mean by self contained or otherwise? Can you precisely describe what you are doing?

/cc @watashiSHUN

@nsp5074
Copy link

nsp5074 commented May 22, 2018

I've tried using the following when publishing directly to a new app service (created a new app service / resource group last thursday/friday) from Visual Studio

Target Framework: netcoreapp2.1
Deployment Mode: Framework-Dependent
Target Runtime: win-x86
and
Target Framework: netcoreapp2.1
Deployment Mode: Self-Contained
Target Runtime: win-x86

publish-connection
publish-settings

@davidebbo
Copy link
Contributor

Can you deploy using 'Framework-Dependent' to a dummy test app and share its name for investigation?

See also this page for general investigation tips for Core on App Service.

@nsp5074
Copy link

nsp5074 commented May 22, 2018

https://test-2-1.azurewebsites.net/
https://test-2-1.azurewebsites.net/api-docs/ is a simple swagger page with the single endpoint that returns some git information
(I can confirm this same behavior working as expected with this code running in VS locally)

I actually am able to attach a debug process to the code in VS and set a breakpoint within the one endpoint. The breakpoint will actually be hit, but a 404 is returned instantly anyway.

It was published with
Target Framework: netcoreapp2.1
Deployment Mode: Framework-Dependent
Target Runtime: win-x86

@davidebbo
Copy link
Contributor

https://test-2-1.azurewebsites.net/api-docs/ seems to work fine for me. Can you clarify what problem you are having? You only describe what you did to deploy, but I don't see anything in any of your comments that actually describes a problem. Please be as precise as you can be to help us understand your issue.

@nsp5074
Copy link

nsp5074 commented May 22, 2018

If you try to actually test the single endpoint on that swagger page, it should return a 404. You can also try calling it directly here https://test-2-1.azurewebsites.net/info/version

@davidebbo
Copy link
Contributor

I see. And when that happens, is that reaching your code at all (e.g. check via tracing)? What debugging steps have you taken to try to further isolate? Make sure to enable all logging per this article above. Also, is there any evidence of a crash? i.e. if you look via Kudu process explorer, do you see the dotnet.exe process changing, or is it always the same one up and running?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants