I am trying to deploy my blazor WebAssembly project to IIS localhost. However, it does not load in the browser with the following errors:
So far I have tried to resolve this issue by setting "PublishTrimmed" to false. This did not resolve my issue. I have seen other people online have a similar problem and recommended the fix just mentioned (which did not resolve the issue for me). Thanks.
The fix for me was to delete the bin and obj folders in, both, the server and client projects with "PublishTrimmed" set to false in the csproj of the server project. Then use dotnet publish -o "location" -c release in powershell (in the server project directory) to publish to the target location set in IIS. Now everything works as expected.
I have a fully working web api written in dotnet core 3.1. I've been following the TimCoRetailManager series.
The application builds with no errors and works as intended when running in Visual Studio. I have a free azure subscription. I setup a F1 free web app service on linux and two basic SQL server databases, all in the same resource group with the firewall set to allow access to other azure services to connect. I can publish the web api and the databases. I can connect to the databases with azure data studio and things look fine. I updated the config on the app service so it's using the azure secrets instead of my dev environment secrets. The API works as intended when published from Visual Studio, i can get to the swagger ui, and life is good.
On to Azure DevOps. When I use a release pipeline from Azure DevOps, the pipeline gives a success message. However, when I navigate to the API (has a simple MVC landing page + swagger) it just has an "Application Error :(" page. I found the logs on the Azure App service and they have this...
Ok 2022-03-01T21:44:43.8098649 \/ \/ \/
Ok 2022-03-01T21:44:43.8098677 A P P S E R V I C E O N L I N U X
Ok 2022-03-01T21:44:43.8098704
Ok 2022-03-01T21:44:43.809873 Documentation: http://aka.ms/webapp-linux
Ok 2022-03-01T21:44:43.8098757 Dotnet quickstart: https://aka.ms/dotnet-qs
Ok 2022-03-01T21:44:43.8098784 ASP .NETCore Version: 3.1.21
Ok 2022-03-01T21:44:43.809881 Note: Any data outside '/home' is not persisted
Ok 2022-03-01T21:44:44.3985103 Running oryx create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -defaultAppFilePath /defaulthome/hostingstart/hostingstart.dll -bindPort 8080 -userStartupCommand 'dotnet TRMApi.dll'
Ok 2022-03-01T21:44:44.4498212 Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
Ok 2022-03-01T21:44:44.4499139 Could not find operation ID in manifest. Generating an operation id...
Ok 2022-03-01T21:44:44.4500119 Build Operation ID: 74cf02f2-a6c2-44a8-9077-95f1bab9d974
Ok 2022-03-01T21:44:45.5344493
Ok 2022-03-01T21:44:45.5358264 Agent extension
Ok 2022-03-01T21:44:45.5358438 Before if loop >> DotNet Runtime
Ok 2022-03-01T21:44:46.2152908 DotNet Runtime 3.1Writing output script to '/opt/startup/startup.sh'
Ok 2022-03-01T21:44:46.6953451 Running user provided startup command...
Ok 2022-03-01T21:44:46.7448258 It was not possible to find any installed .NET Core SDKs
Ok 2022-03-01T21:44:46.7453653 Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
Ok 2022-03-01T21:44:46.7457829 https://aka.ms/dotnet-download
The build pipeline appears to be working as intended. It produces four artifacts: a folder for the web api with a zip for deployment, a folder for the database stuff notably with a dacpac, and a folder for the front end with a zip file in there, too. The release pipeline isn't publishing all of this though. I set the package to $(System.DefaultWorkingDirectory)/_Standard Continuous Integration Build/ApiDrop/TRMApi.zip.
The release pipeline has the following settings:
Azure subscription: selected free trial and authenticated it
App Type: Web App on Linux
App Service name: selected api's name from drop down
Startup command: blank
Agent Job
Agent: Azure Pipelines
Agent Specification: windows-2019
Artifact download: continuous integration build > selected all artifacts
Deploy Azure App Service step
Task version: 4.*
Connection type: Azure Resource Manager
Azure subcription: read only, prefilled by app service selection earlier
App service type: also read only, prefilled
App service name: also read only, prefilled
Package or folder: $(System.DefaultWorkingDirectory)/_Standard Continuous Integration Build/ApiDrop/TRMApi.zip
Runtime Stack: 3.1 (DOTNETCORE|3.1)
Any tips or suggestions? I'm really scratching my head on this. I'm watching videos on pluralsight and youtube and it seems like the process "just works" for the content creators, but I'm not able to repeat the results.
Edit: Including screenshot of how artifact is configured in release pipeline.
FWIW, I have the exact same problem from the exact same code base.
I also have the build pipeline artifact set up correctly.
I initially got caught up on the message "It was not possible to find any installed .NET Core SDKs".
I went to the app service "Advanced tools" and then used Bash and issued the commands:
dotnet --list-sdks
dotnet --list-runtimes
Initially, it wasnt reporting any sdk's.
This led to me adding an additional Use.NET Core pipeline task at the beginning of the pipeline with the following parameters
Display Name:
Use .NET Code sdk 3.1.415
Package to install:
SDK (contains runtime)
Version:
3.1.415
Compatible Visual Studio version:
16.7.21
Path to Install .Net core:
$(Agent.ToolsDirectory)/dotnet
I chose the above versions which seemed to match what was reported being available on the linux box.
However, none of this seemed to make any difference, as it still fails with the same error as you. I did want to share what I have tried so far, but wasnt enough to solve it.
On a whim, I spun up a Windows-based App server (Free tier) to deploy to as well. I modified my Release pipeline and added a second "Deploy to App Service" step. This second one deploys to the Windows App Service.
Once I did this, the app runs successfully on the Windows App Service after the second deployment step, but not on the Linux app service after the first deployment step.
It turns out the issue was due to a Build pipeline issue.
It was building the API project using a Visual Studio Build (i.e. MsBuild) project step.
In order to target linux, this needs to be replaced with a
dotnet publish (or a dotnet build followed by a publish) with the parameters "-r linux-x64" plus the appropriate output folder.
Build pipelines and release pipelines do not use the same system default working directory. So I think your release pipeline is probably not getting the artifacts in the build pipeline.
There is an easy way to pass artifacts generated in build pipelines to release pipelines:
In your build pipeline, Use publish build artifact task or publish pipeline artifact task to publish your artfact.
In your release pipeline, click "Add an artifact". Then select "Build" as source type and fill in the information about your build. Note the value of "Source alias", which you need to use as the name for artifacts in release pipeline.
Go to the "Azure App Service Deploy" task. In "Package or folder", click browse button, and you can find your artifacts path there.
I'm having a problem publishing and deploying my backend on centos.
First related to publishing the backend. Below attached a picture of the project of my web API.
I am not sure if this is the correct wayI've published them by using this code below:
dotnet publish -c debug -r linux-x64 --self-contained
on each one of the folders except the Test. So I have 3 published projects.
I then transfer it to my centos 7 servers using scp.
Then I open the published OamrBackend.Web server and give permission to the app using chmod 777 ./OamrBackend.Web and then run it.
This is what it shows:
(I am not sure if this is the correct way)
When trying to access this API from my PC it shows a page error This site can’t be reached ERR_CONNECTION_REFUSED.
What was the error here? Is it the way I try to publish is incorrect or they deploy was incorrect?
I wrote this small .net core app that backup and transfer mysql database from a server to a dockerized app. However, when I put it in docker and try to run it nothing happens. If there is an error in the app it should console.writeline the error message but nothing.
FROM mysql:5.7.34
COPY ./dbmover /tmp/dbmover
WORKDIR /tmp/dbmover
EXPOSE 3306
As you already figured out my released .net core app is contained in the dbmover folder and copied on the docker container.
Now if I connect to the container shell and execute the app I get no output of it. I run ./myapp.exe
There are my release settings for my app.
Note that this application is not meant to be dockerized it is just a tool to help build the container.
What am I doing wrong ?
SO I didn't noticed at first but I was publishing with visual studio instead of the command line tool. Once it is done publishing it is ginving you the path of the publish. What I ddin't notive is that it was the parent folder of the publishing folder which was linux-x64 folder. Once I took the linux-x64 subfolder instead of the main one it started working.
I want to publish a sample .net core web application on my pc's IIS manager but I failed. I am using Microsoft guidance but it doesn't work for me, if you have reasonable experience to fix this problem I would be grateful to see your suggestions.
I was missing the AspNetCoreModule from IIS->Modules. After I installed that I no longer had the 500.19 error.
To find out more this blog was great: https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS
Here is the page from Microsoft to find the download: https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
You have to install the "Hosting Bundle Installer". Without this, IIS doesn't understand routing and cannot host your application.
Go to microsoft site "https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1" and install "Hosting Bundle Installer":
Before installing this you have to install the right version of runtime:
https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1
Than install the right version of "Hosting Bundle Installer".
"Hosting Bundle Installer" is:
.NET Core Windows Server Hosting bundle installs the .NET Core Runtime, .NET Core Library,
and the ASP.NET Core Module. The module creates a reverse proxy between IIS and the Kestrel server on Windows platforms.
The identity under which your web application runs in IIS doesn't have full access to the folder in which the web.config file is found.
Which version of IIS are you using? Assuming 7, you can view/change the identity through the 'Advanced Settings' of the application pool that hosts your application. Folder permissions can be granted via Windows Explorer in the usual way.
Sure, you have to follow this tutorial to deploy to IIS:
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis
I would suggest you to do this:
Publish your web application to desktop.
Copy the folder to the server.
Open cmd and run cd
In cmd run
dotnet webapplication.dll
You should see that application is run and waiting for responses on localhost:port.
Open browser and navigate there. It should work.
Otherwise, you will be able to see all the errors in the cmd window.
OR
Go to microsoft site "https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1" and install "Hosting Bundle Installer":
In my case I was getting the same error.
It was nothing to do with the permissions.
I had to install the followings
1- Microsoft .NET Core Runtime
2- Microsoft ASP.NET Core Runtime
3- Microsoft ASP.NET Core Hosting Bundle
from the below location. (Please chose the relevant version)
https://dotnet.microsoft.com/download/archives
Then I had to execute the following commands as well.
net stop was /y
net start w3svc
You can either restart the machine.
That fixed for me.
Try to edit/open any configuration for the site.
If you can't access the configuration options for the site under IIS Manager, check commenting the tag < aspNetCore >, if problem solve, uncomment it and install.
ASP.NET Core Hosting Bundle.
ASP.NET Core 3.1 Runtime (v3.1.3) - Windows Hosting Bundle Installer.
Write dotnet --info in your command prompt to see your SDK versions. (after words .NET SDKs installed:)
Find your equal Hosting Bundle version and install it.
For example : SDK 3.1.408 needs Hosting Bundle 3.1.14.
https://karthiktechblog.com/aspnetcore/how-to-solve-http-error-500-19-internal-server-error-in-windows-server-iis-for-dotnet-core-application
We've observed this problem on our server even though Hosting Bundle was already installed. The problem was, the hosting bundle was installed BEFORE IIS feature was enabled. The fix was to Repair hosting bundle install by running the installer again.
Very good, in my case a module called "urlrewrite" was missing.
You install it with the "Microsoft Web Platform Installer" application.
I also had this problem and the problem was solved by installing the Hosting Bundle Installer.
You can install from url:
https://dotnet.microsoft.com/download/dotnet
We had a slightly different issue at my work. We had a publish profile in Visual Studio set to delete all files upon publishing, and this was a problem for us because we manually gave our IIS service account filesystem permissions to that one, explicit folder beforehand.
So with that publish flag enabled, it zapped the folder and its permissions alongside it and caused a filesystem permissions issue after.
We just disabled this flag in the Visual Studio publish profile and it was fine after that.