Blazor server side deployment http 500 error - c#

i have a problem when i deploy my blazor app (self-contained or framework-dependent) to a private server.
App works properly on visual studio debug mode, i can process crud operations even on remote server.
However when i deploy the app, i get http 500 error and i cant find any additional information. None of the pages are opening.
I checked the _Host.cshtml and Startup.cs files. The app doesn't have complex pages or packages for now, only use asp net core identity with ef core.
Where should i look into first, what could you suggest?
https://i.stack.imgur.com/yN50q.png

Finally i find the solution.
When i deploy the app on azure, it says there is a error about mysqlconnector, and i delete ServerVersion.AutoDetect (Pomelo package), set the version by hand in Startup.cs and it works. But i don't know why it works.

Related

.NET web app published to Azure has no pages

After publishing a web app without errors from Visual Studio 2019 to an Azure web app, the website 404s and I can see in the console that there are only DLLs and an EXE in wwwroot - no aspx or html files. There are some scripts and CSS files in wwwroot/wwwroot.
What am I missing? I'm new to C#.NET, so it's probably something fundamental, but I haven't found an answer yet.
What would be deployed depends on your project's file structure.
If your web app runs successfully, don't mind about the content in wwwroot. If not, make sure your project could run successfully local, then deploy follow this tutorial: Quickstart: Deploy an ASP.NET web app
It turns out that the web app will 404 on lots of types of errors, in this case a problem connecting to the database. I was able to figure it out using Diagnostic Tools and the application error logs, so would recommend anyone else having unexplained 404s to check the logs. Pretty basic stuff, but as I said this is all new to me.

Default Blazor template not working on Azure

Making sure that you have all the following done: https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-8/
If you create a new Project in VS 2019 and use the Hosted Blazor template and then without modification (once you have it building and working on your local machine) Publish it to Azure. You will see that when you go to the fetchdata page, that no data is returned when running in Azure, however locally it works fine.
This does not seem to be a CORS issue as all requests are from the same domain. I have tried modifying the web.config to remove WebDav. I have asked on github: https://github.com/aspnet/AspNetCore/issues/13630#issuecomment-527678673
They told me to ask here and think it's me.
Here is the site: http://daringclub.azurewebsites.net/fetchdata
If you load up the template, you literally have the exact same code.
I would expect that using the template and immediately publishing to azure without making any changes should just work out of the box.
Edit:
I've just upgraded to .net Core 3 Preview 9 and have been able to successfully publish the Blazor template (Client, Server and Shared version, I think it's called Blazor Client Hosted or something).
I now need to comment out code from my main site till stuff works, cause that's how I program ;)
As Henk provided, check if you have self-contained app and make sure Azure could host .net core 3.0 then publish it.
In the Azure Portal, go to your WebApp after deployment (or create one beforehand).
Go to Extensions and click Add and select ASP.NET Core 3.0 (x86 for the free hosting).
Also go to Configuration, General settings and enable Web Sockets, they're Off by default.
Refer to this SO thread.

ASP.NET MVC Core Deployment via Visual Studio does not work

I am sorry to ask a question which doesn't have a specific problem, but I would be more than grateful if you could point the problem. (I can always provide other parts of my code which would be relevant to my question)
I am using Visual Studio to create my web application with ASP.NET MVC Core. All is good with the project and I can make it work on my localhost.
I bought a third party hosting service with Windows hosting (Plesk) and as far as I've asked them, they said their hosting plan supports ASP.NET Core.
For the deployment part, I've literally searched each and every source and tried various different methods but could not properly upload my files on ftp. Trying ASP.NET Core 1.0.0 version worked well and I uploaded a sample website, but since I am working with ASP.NET Core 1.1.0 now, I am unable to find a solution.
Here is what my publish profile looks like before hitting publish button:
I'm not really sure if I filled all the information correctly, but validation seems to work well.
And here is the log which I get after trying the publish via ftp method in visual studio:
Even though it seems to succeed, when I look at my ftp directory after this process, the files in visual studio project were never uploaded in the directory.
Any help is appreciated, thanks.
I have deploy the same on my server and it is working fine see the attached screenshot.

Unable to run ASP.NET Core rc2 in IIS

So, I've been trying to publish my Core App to local IIS server but whatever I do it just doesn't want to run.
What I do is find the project in windows explorer and open a command window there, and write the following:
dotnet publish --framework netcoreapp1.0 --output "C:/ReleaseWebsite" --configuration Release
Which well executes without any errors, and finally says that it published the project correctly.
After that I go to IIS and Add New Website, set it to port 80 or 8080, I even tried with 8088, and after set the path to the published files, I edit the Application Pool and set it to No Managed Code. Start the website but all I get it 500 error An error occurred while starting the application.
If I go manually to the published files and open GST.Web.exe it starts without any issues, and rusn on port 5000 and I can access it without any problems. But I want to run it in IIS. Any help?
Refer Publishing to IIS article.
I think you must have done all the steps from this article except installing .NET Core Windows Server Hosting bundle on the server.
Install the .NET Core Windows Server Hosting bundle on the server.
This bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server.
See if this helps.

/signalr/hubs not being generated when upgrading to SignalR-2.0.0-beta2

I have a working chat like application running on SignalR 1.1.2 that will be put onto load balanced servers, so I need to implement a backplane solution to sync up the servers.
This is an ASP.NET MVC4 .NET 4.5 application. Using SignalR Hubs, and not Persistent Connection. The app utilizes AngularJS on the client side to handle the ui bindings and updates.
I've followed the steps listed out here to implement the sql server backplane and used the steps outlined in the 1.x to 2.0 migration outlined out here. The solution builds, but when hitting the page that utilizes SignalR the "/signalr/hubs" script reference returns a 500 error.
Here's a list of steps I took so far.
Using nuget, removed all references and dependencies related to SignalR 1.1.2. Double checked /bin and /packages directories to make sure they no longer reference any old libraries. This is per comment found on the github issue relating to a 2.0 upgrade that said uninstalling and reinstalling SignalR was the way to go for an upgrade.
Installed SignalR 2.0.0-beta2 via Package Manager Console (PMC)
Install-Package Microsoft.AspNet.SignalR -Pre
Installed SQL Server Messaging Backplane using PMC Install-Package Microsoft.AspNet.SignalR.SqlServer -Pre
Removed RouteTable.Routes.MapHubs(); from Global.asax
Created Startup class in root of project.
Startup.cs
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Owin;
namespace My.NameSpace
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapHubs();
}
}
}
Added <add key="owin:AppStartup" value="My.NameSpace.Startup, App_Code"/> to <appSettings> inside Web.config
Put a breakpoint in the Startup.Configuration() method and verified that it was getting hit and executing app.MapHubs without exceptions when the app started
I'm not using Persistent Connection, so did not include the line app.MapConnection<MyConnection>("/echo"); and am not getting any ambiguous definition issues.
The chat app page references the following libs
jquery-1.8.3.js
jquery.signalR-2.0.0-beta2.js
<script src='/signalr/hubs'></script>
AngularJS v1.1.5
When the project runs, /signalr/hubs is not found by the chat app page
chrome dev tools returns 500 Internal Server Error for the /signalr/hubs call on the network tab.
the file system does not have a /signalr/hubs directory
My next step is to see if I can create a new solution with a very basic hub and see if I can get Signal 2.0 working. If it does I'll compare the two solutions to see what the differences are.
Does anyone have an idea of what else I could check or research to get this working?
Related StackOverflow questions with a similar issue: one, two
Turns out the issue was fixed by changing the project config to use Local IIS Web server instead of Visual Studio Developer Server (Cassini).
Found the cause by going to /signalr/hubs url in my browser and seeing the server error which was
System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.
Some googling turned up this page which said the error was caused by ASP.NET Development Server not supporting integrated pipeline mode.
You can change the server used by right clicking on the project, select properties, hit the web tab, and under the servers section select "Use Local IIS Web server".
In my case IIS wasn't installed properly. I just had to reinstall it:
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Categories