Getting blank page after Azure deployment - Web Api .Net 6.0

Marjan 20 Reputation points
2023-07-11T06:42:24.6466667+00:00

I'm trying to deploy my project on Azure. During the process I didn't get any error message, however, when I try to open the link I get blank page.

The application is working smoothly on my local machine, I'm not sure what could be the problem. I tried to deploy it several times. Any help is appreciated!

Application info: Web Api .Net 6.0

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,206 questions
{count} votes

Accepted answer
  1. JasonPan - MSFT 4,706 Reputation points Microsoft Vendor
    2023-07-11T09:04:49.3766667+00:00

    Hi @Marjan,

    You are trying to deploy .net 6 api project to azure. Now you are facing 404 error, it's expected behavior. You can try to check the /WeatherForecast endponit works or not. It should works normally.

    If you want to open the swagger page, we need to comment the condition in Program.cs ,like below

    // Configure the HTTP request pipeline.
    if (app.Environment.IsDevelopment())
    {
        app.UseSwagger();
        app.UseSwaggerUI();
    }
    

    to

    // Configure the HTTP request pipeline.
    //if (app.Environment.IsDevelopment())
    //{
          app.UseSwagger();
          app.UseSwaggerUI();
    //}
    

    Then we can open the swagger index page.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Jason Pan


6 additional answers

Sort by: Most helpful
  1. RevelinoB 2,775 Reputation points
    2023-07-11T06:54:15.08+00:00

    Hi Marjan,

    When you deploy your project to Azure and encounter a blank page when accessing the application, there could be a few potential issues to investigate. In my opinion there are some steps you can take to troubleshoot the problem:

    • Check the Azure portal logs: Go to the Azure portal and navigate to your Web App. In the "Monitoring" section, look for the "Logs" or "Diagnostic Logs" option. Check the logs to see if there are any error messages or exceptions that can provide insights into the issue.
    • Ensure the correct deployment: Confirm that you deployed the correct artifacts to Azure. Double-check that you included all necessary files, libraries, and dependencies required for your .NET 6.0 Web API application.

    Check the application logs: Make sure your application is configured to log information, especially any errors or exceptions. Review the application logs to see if there are any clues about what might be causing the blank page.

    Verify connection strings and configurations: Ensure that any connection strings, API keys, or configuration settings required for your application to function correctly are properly set in the Azure App Service settings. Check if any environment-specific configurations are missing or incorrect.

    Enable detailed error pages: By default, Azure may display generic error pages for security reasons. To get more detailed error information, you can temporarily enable detailed error pages. In the Azure portal, go to your Web App's "Configuration" section, and under the "General settings" category, set "Detailed error messages" to "On." This change will allow you to see any specific error messages instead of a blank page.

    Verify startup and routing configuration: Ensure that the startup configuration and routing setup in your .NET 6.0 Web API application are correctly configured for the Azure environment. Check that the correct routes are registered, and any middleware or services required for your application are properly set up.

    Enable Application Insights: Consider setting up Application Insights for your Azure Web App. It provides detailed monitoring and debugging capabilities for your application, including performance metrics, exception tracking, and logging. It can help identify the root cause of the issue by collecting telemetry data.

    Review deployment logs: When deploying your application to Azure, there should be deployment logs available. Check these logs for any error messages or warnings that could shed light on the problem. The deployment logs may be accessible through the Azure portal or by using Azure CLI or Azure PowerShell.

    By following these steps, you should be able to gather more information about the issue and narrow down the possible causes. If you still can't identify the problem, consider providing additional details or error messages you encounter so that I can assist you further.

    Please let me know if this helps?

    0 comments No comments

  2. Marjan 20 Reputation points
    2023-07-11T07:30:23.75+00:00

    I checked everything multiple times, I'm assuming the problem might be with the certificate but its just my opinion. This is my attempt with github.

    Here is the yml file:

    # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
    # More GitHub Actions for Azure: https://github.com/Azure/actions
    
    name: Build and deploy ASP.Net Core app to Azure Web App - odwelektrikmk
    
    on:
      push:
        branches:
          - development
      workflow_dispatch:
    
    jobs:
      build:
        runs-on: windows-latest
    
        steps:
          - uses: actions/checkout@v2
    
          - name: Set up .NET Core
            uses: actions/setup-dotnet@v1
            with:
              dotnet-version: '6.0.x'
              include-prerelease: true
    
          - name: Build with dotnet
            run: dotnet build --configuration Release
    
          - name: dotnet publish
            run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
    
          - name: Upload artifact for deployment job
            uses: actions/upload-artifact@v2
            with:
              name: .net-app
              path: ${{env.DOTNET_ROOT}}/myapp
    
      deploy:
        runs-on: windows-latest
        needs: build
        environment:
          name: 'Production'
          url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    
        steps:
          - name: Download artifact from build job
            uses: actions/download-artifact@v2
            with:
              name: .net-app
    
          - name: Deploy to Azure Web App
            id: deploy-to-webapp
            uses: azure/webapps-deploy@v2
            with:
              app-name: 'odwelektrikmk'
              slot-name: 'Production'
              publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_C7341A09C79243CCBC4C154B6B02568B }}
              package: .
    
    
    

    Application logs:
    IIS Detailed Error 404

    2023-07-11T07:24:13 Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds).
    2023-07-11 07:23:26 ~1ODWELEKTRIKMK GET /api/logstream/http X-ARR-LOG-ID=602a594b-efe4-43d6-bc0f-16d6410c49e8 443 - 62.162.112.210 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:109.0)+Gecko/20100101+Firefox/115.0 - - odwelektrikmk.scm.azurewebsites.net 200 0 64 669 1335 34749
    2023-07-11 07:23:54 ODWELEKTRIKMK GET / X-ARR-LOG-ID=c05e7131-d91c-4347-86e5-fd81ea1220ac 443 - 62.162.112.210 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:109.0)+Gecko/20100101+Firefox/115.0 ARRAffinity=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f;+ARRAffinitySameSite=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f - odwelektrikmk.azurewebsites.net 404 0 0 419 1319 0
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>IIS Detailed Error - 404.0 - Not Found</title><style type="text/css"><!--body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}.config_source code{font-size:.8em;color:#000000;}pre{margin:0;font-size:1.4em;word-wrap:break-word;}ul,ol{margin:10px 0 10px 5px;}ul.first,ol.first{margin-top:5px;}fieldset{padding:0 15px 10px 15px;word-break:break-all;}.summary-container fieldset{padding-bottom:5px;margin-top:4px;}legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;}legend{color:#333333;;margin:4px 0 8px -12px;_margin-top:0px;font-weight:bold;font-size:1em;}a:link,a:visited{color:#007EFF;font-weight:bold;}a:hover{text-decoration:none;}h1{font-size:2.4em;margin:0;color:#FFF;}h2{font-size:1.7em;margin:0;color:#CC0000;}h3{font-size:1.4em;margin:10px 0 0 0;color:#CC0000;}h4{font-size:1.2em;margin:10px 0 5px 0;}#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS",Verdana,sans-serif;color:#FFF;background-color:#5C87B2;}#content{margin:0 0 0 2%;position:relative;}.summary-container,.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}.content-container p{margin:0 0 10px 0;}#details-left{width:35%;float:left;margin-right:2%;}#details-right{width:63%;float:left;overflow:hidden;}#server_version{width:96%;_height:1px;min-height:1px;margin:0 0 5px 0;padding:11px 2% 8px 2%;color:#FFFFFF;background-color:#5A7FA5;border-bottom:1px solid #C1CFDD;border-top:1px solid #4A6C8E;font-weight:normal;font-size:1em;color:#FFF;text-align:right;}#server_version p{margin:5px 0;}table{margin:4px 0 4px 0;width:100%;border:none;}td,th{vertical-align:top;padding:3px 0;text-align:left;font-weight:normal;border:none;}th{width:30%;text-align:right;padding-right:2%;font-weight:bold;}thead th{background-color:#ebebeb;width:25%;}#details-right th{width:20%;}table tr.alt td,table tr.alt th{}.highlight-code{color:#CC0000;font-weight:bold;font-style:italic;}.clear{clear:both;}.preferred{padding:0 5px 2px 5px;font-weight:normal;background:#006633;color:#FFF;font-size:.8em;}--></style>
    </head><body><div id="content"><div class="content-container"><h3>HTTP Error 404.0 - Not Found</h3><h4>The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.</h4></div><div class="content-container"><fieldset><h4>Most likely causes:</h4><ul> <li>The directory or file specified does not exist on the Web server.</li> <li>The URL contains a typographical error.</li> <li>A custom filter or module, such as URLScan, restricts access to the file.</li> </ul></fieldset></div><div class="content-container"><fieldset><h4>Things you can try:</h4><ul> <li>Create the content on the Web server.</li> <li>Review the browser URL.</li> <li>Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul></fieldset></div>
    <div class="content-container"><fieldset><h4>Detailed Error Information:</h4><div id="details-left"><table border="0" cellpadding="0" cellspacing="0"><tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;AspNetCoreModuleV2</td></tr><tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr><tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;aspNetCore</td></tr><tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr>
    </table></div><div id="details-right"><table border="0" cellpadding="0" cellspacing="0"><tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;https://odwelektrikmk:80/</td></tr><tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;C:\home\site\wwwroot</td></tr><tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr><tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr>
    </table><div class="clear"></div></div></fieldset></div>
    <div class="content-container"><fieldset><h4>More Information:</h4>This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.<p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=404,0,0x00000000,14393">View more information &raquo;</a></p><p>Microsoft Knowledge Base Articles:</p>
    </fieldset></div></div></body></html>
    2023-07-11 07:24:47 ODWELEKTRIKMK GET / X-ARR-LOG-ID=501705a8-2faf-4adb-8311-eb2382f5e8c5 443 - 62.162.112.210 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:109.0)+Gecko/20100101+Firefox/115.0 ARRAffinity=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f;+ARRAffinitySameSite=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f - odwelektrikmk.azurewebsites.net 404 0 0 419 1319 0
    2023-07-11 07:24:47 ODWELEKTRIKMK GET /favicon.ico X-ARR-LOG-ID=e84c4821-faef-4f32-8cd8-4a59cc3de9d0 443 - 62.162.112.210 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:109.0)+Gecko/20100101+Firefox/115.0 ARRAffinity=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f;+ARRAffinitySameSite=92ca53ad8db4fbb93d4d3b7d8ab54dcf8ffecb2d731f25b0e91ad575d7534c3f https://odwelektrikmk.azurewebsites.net/ odwelektrikmk.azurewebsites.net 200 0 64 0 1326 0
    
    
    

    On azure - Usage (this ASP)60.41MiB.


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Marjan 20 Reputation points
    2023-07-11T08:09:18.56+00:00

    User's image

    0 comments No comments