Error when releasing from VSTS to Azure Web App - azure

I have created a simple release definition in VSTS that takes a built .net core web app and pushes the build out to an Azure Web App. Unfortunately this fails on the last step with the error:
##[error]Error: Offset is out of bounds
Does anyone know what might cause this?

This was caused by a couple of issues:
1) I was using the .net core build task which required I supply a path to the .csproj, it couldn't find my .csproj. I switched it to the command line task instead and this then fixed that issue.
2) The other issue was that I was using the wrong hosted build agent. When I switched to the VS2017 build agent it all worked.

Related

ASP NET Core 5.0 not supported in Azure

Hello i have a ASP Net Core 5.0 web api which i am trying to deploy to azure and i can't because it says it is not yet supported.
However following the MSDN and similar threads ( when the same issue was valid for .NET Core 3.1) i understood that you can publish it with the option to be self-contained.
It still does not work:
Application Logs
VStudio Publish
Any idea on how to publish my application to azure ?
Later Edit
I forgot to mention all calls to my web api return a 404 message.
So if my
[indexurl] returns the microsoft page
[Indexurl]/[some path] returns 404 (which i understood from github is a 500 actually)
What should i understand ? The web api works , or it doesnt and where could the problem be ?
ASP NET Core 5.0 not supported in Azure
After testing, azure webapp currently supports ASP.NET Core 5.0.
According to your description, I conducted a test, first tested under windows, it was normal. Then deployed and tested under Linux, it is normal.
I guess the reasons may be the following two:
There is a problem with your .Net 5.0 installation. It may be used when compiling, if necessary, and cause compilation exception and release failure. (The possibility is relatively low)
It is possible that the webapi created by default does not have a default index page, so you feel that it is not supported. In fact, you can use webapp for testing, or you can write an interface for testing yourself.
The VS2019 version I used for testing is Microsoft Visual Studio Enterprise 2019 Version 16.8.2. And I installed .net 5.0 Runtime on the machine.
For your question, describe in detail the steps of testing under Linux:
Step 1. Create Core5.0 Webapi Project.
Step 2. Test in local, and it works fine.
Step 3. Deploy to azure with Deployment mode is Framework-dependent.
And test it, it look likes something wrong because the project don't set default route, and I input the WeatherForecast to access default interface, it works.
Step 4. Deploy to azure with Deployment mode is Self-Contained like you pic.
And it also works fine.

ASP .Net core project CI\CD fails in Publish using DevOps Project

We have an ASP.Net core 2.1 Devops project build and released successfully. But when we try accessing we are getting error.
HTTP Error 502.5 - Process Failure
If we take the drop from artifacts and try local it is working perfect. Please help!
After enabling stdoutLog, we got the following error details.
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0-preview1-final' was not found.
- Check application dependencies and target a framework version installed at:D:\Program Files (x86)\dotnet\ - Installing .NET Core prerequisites might help resolve this problem:http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:https://aka.ms/dotnet-download - The following versions are installed:2.1.2 at [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Our application was using '2.1.0-preview1-final', seems Azure installed the latest version 2.1.2 for the DevOps environment. We updated our application with Core 2.1.2 and tried again. Now the application runs successfully without any error.
Thank you Martin Brandl!
Your best shot will be to enable logging to track down the error:
Go to the Kudu environment (https://YOURSITE.scm.azurewebsites.net)
On the top menu, select Debug console -> PowerShell
Navigate to site -> wwwroot and open the web.config
Set the stdoutLogEnabled attribute to true and save the file.
Create a folder named logs next to the web.config using mkdir logs
Now if you try to browse your site again, you should see a log file within the previously created directory containing additional information.
See also:
Determine whats wrong with your Azure Web / API App deployment

Exception during publishing web app to Azure

We have created a sample Asp.net Core application. When we tried to publish the application into Azure we got following exception.
Web deployment task failed. (The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception.)
We have tried some solutions posted in some blogs but none got the issue resolved.
Here are some ways you could try:
1.Look for a key in the registry under the following paths that points the the problem assembly and delete it:
HKLM\Software\Microsoft\IIS Extensions\msdeploy\3\extensibility
HKLM\Software\Wow6432Node\Microsoft\IIS Extensions\msdeploy\3\extensibility
The problem registry key is installed by SQL.
2.Reinstall Web Deploy 3.5.
3.Uninstall dbsqlpackage provider . this packages no longer support.
4.Restarted Visual Studio and rebuilt the project.
For more details, you could refer to this thread.
It sounds like you are trying to create a web job and publish it to a App Service in Azure. To do this you have to create a Azure WebJob project type in visual studio. To get this project type in VS you have to install it or download it using nuget.
Installing "Web Deploy 3.5" extension helped me solve this issue.
https://www.iis.net/downloads/microsoft/web-deploy

Asp.Net Core 2.0 on Azure results in a 502.5

I have a small web app developed with Asp.Net Core 1.1 deployed on Azure and it works well. I just migrated the project to use Asp.Net Core 2.0 and tried to deploy it on Azure. The deployment went fine but when I open the site, I get a 502.5 error. When I check my Azure log stream, I get the following error:
This error occurs when a CGI application does not return a valid set
of HTTP headers, or when a proxy or gateway was unable to send the
request to a parent gateway. You may need to get a network trace or
contact the proxy server administrator, if it is not a CGI problem.
Useless to say that it works well on my development machine with the same code. Note that I'm also using Entity Framework Core 2.0 although I deactivated the database creation on Azure (to check if it was not the cause).
For information, the way I migrated from 1.1 to 2.0 is by changing the target framework settings to "netcoreapp2.0" and by using the NuGet package "Microsoft.AspNetCore.All". Just to be sure, I also deleted my publish profile and recreate one.
Is it possible that Asp.Net Core 2.0 is not yet available on Azure ? I'm fairly new to Asp.Net Core, so I don't know when new releases are made available on Azure.
EDIT
When I try to run my app with dot net CLI via the debug console as proposed by natemcmaster, I got the following issue:
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'Microsoft.AspNetCore.Hosting.Abstractions,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I downloaded the DLL on my desktop and check the version with Dot Net Peak and indeed, the DLL is 1.1.2, although I created the project with Visual Studio and directly publish it, so is it an issue with Visual Studio ? Or Nuget ?
the issue was actually coming from the fact that, at first, my web app was using .net core 1.1, which deploys all the DLL in the "wwwroot" folder of the web application. However, with asp.net core 2.0, it does not do that anymore as the DLL are picked up from a global store. However, as Visual Studio does not clean the destination folder before a publish, I ended up with a situation where the 1.1 DLL were in my wwwroot, so the web site was picking up these ones instead of the 2.0 ones in the store folder.
This is explained in more details here: https://github.com/Azure/app-service-announcements-discussions/issues/2#issuecomment-313816550
Others have explained the reason why this is happening. I'd like to provide another – arguably easier – solution to the problem.
Just change the settings so that you remove files that are already on Azure – see below:
Check for log files either in the portal or by remotely accessing D:\home\LogFiles.
Sometimes, the logs won't indicate what is going wrong. Another good way to investigate further is to try launching your ASP.NET Core app from the Debug Console. If you are missing a shared framework version or there is another startup error, this will be more visible from the Debug Console.
Go to
https://(your web site name here).scm.azurewebsites.net/DebugConsole/
Your site will be in D:\home\site\wwwroot. You can launch it by executing:
cd D:\home\site\wwwroot
dotnet MyWebApp.dll
If you app still fails to launch, make sure that D:\home\site\wwwroot\web.config is available and configured to use ASP.NET Core Module. https://learn.microsoft.com/en-us/aspnet/core/hosting/aspnet-core-module
In my case, It was caused by having a space in the Project Name.
I can readily add a space, publish => 502.5.
Remove space, publish => good to go.
Hard to believe but I am duplicating it readily with above.
Also using "Remove Additional Files at Destination" per #Sam's Answer
See https://github.com/Azure/app-service-announcements/issues/14
"The rollout is expected to complete by Friday June 30th."
In my case the issue occurred because AppService at that time supported 2.0.0-preview2-006497 but I had 2.0.0-preview3-006890 installed which was used on build.
So I added global.json to use preview 2 SDK and it worked then
I don't know if this could help someone one day but in my case, I was using :
-Microsoft.AspNetCore.All 2.0.5
Downdrage to Microsoft.AspNetCore.All 2.0.3 resolve my problem
This happens when your version of ASP.NET Core cannot be matched on the server.
The simplest solution is to change your settings to deploy the app as self-contained, so it doesn't matter if Azure can match the framework version. Also, delete the files already on Azure, so you don't have issues when upgrading, as explained by #Sam.

Azure Cloud Service error when deploying against v4.6.1

I am having a new issue when deploying Azure Cloud Services via Visual Studio 2015 SP1.
This is driving me up the wall and I am curious if anybody else has seen this? Basically, I can build just fine, I just can't package for or publish to a Cloud Service - the error is:
CloudServices232: The role MyProject.AsyncWorker is using an unsupported TargetFrameworkVersion v4.6.1.
This wasn't happen a few weeks ago, but now I can't publish it. Yes I am targeting .NET 4.6.1 - but that has been WORKING JUST FINE for a while now and I followed all the steps to run install.cmd and manually deploy it.
This appears to be a new build-time error (it used to be a warning).

Resources