I always have bad times publishing to IIS 8.5
I have a old project in .NET Core 1.0, but I have made a new project, but this time, in .NET 4.5 (for several reasons)! This new project (.NET 4.5) replaced the old (.NET Core)
In Visual Studio 2015, everything works correctly, then, I build the project, and copied the files to IIS folder (\inetpub\wwwroot).
When I visit the page, I got a error HTTP Error 502.5 - Process Failure.
Then, I remember that the APP Pool was using .NET Core, so, I changed to .NET CLR 4.0, but still no luck.
I don't even known where is the error LOG on IIS to see if I found anything...
I already see the logs on %WINDIR%\System32\LogFiles\HTTPERR and \inetpub\logs\. No error on logs.
All I found about the error 502.5 is that almost always is related to .NET Core (but i'm using .NET 4.5)
Like I posted on comments, the main error was because the Handler Mapper order.
The old project it was a .NET Core project, and the new project, is a .NET 4.5.
For some reason (or my fault), the Handler Mapper was all wrong.
Related
I am working through some tutorials on Razor Pages using .NET 6.0 and have found that my computer is not wanting to find the localhost when running the application. If I create a basic .NET Core Web App using .NET 5.0 then everything works but if I do the same with .NET 6.0 then it doesn't load, even without any changes.
The message I receive is:
This localhost page can’t be found
No webpage was found for the web address: https://localhost:7273/
HTTP ERROR 404
I can open the same project on another computer and everything works as expected. I assume there is something with local setup that is causing this since the standard template for a .NET Core Web App using .NET 6.0 won't even work.
I have attempted to install the .NET Core 6.0 SDK, the Core Runtime, and the Desktop Runtime and nothing changed.
My launch settings file is:
LaunchSettings.json Image
And my Program.cs is: Program.cs Image
I've spent hours searching various forums but there seems to be very little available for .NET 6.0 and nothing seems to hit what I need, especially since the default starter template for a .NET Core Web App won't even work.
I was finally able to find another post that actually matched the issue I was having. The post can be found here: .NET 6 Core Web App Returns web page not found
I was able to confirm that building through dotnet build in the command line did work but I would have to do that every time I made a code change. I then updated visual studio and it works now.
IIS Website on Server 2016.
using System.Text
string x = "abcdefg";
byte[] y = Encoding.UTF8.GetBytes(x);
Results in:
Compiler Error Message: CS0117: 'Encoding' does not contain a definition for 'UTF8'
It isn't complaining that "Encoding" is undefined, but that .UTF8 in the Encoding class is undefined.
Works fine on my own desktop running IIS Express in Visual Studio, but when deployed to Server, gives the above error message.
My local dev machine has: .NET Framework 4.7.2
Server has only Microsoft .NET Runtime 5.0.9 and Microsoft ASP.NET Core 5.0.9. In fact, the server does not have any version of .NET Framework installed, yet all other web apps (mine and others) are working fine.
Can I install and run .NET Framework 4.7 alongside .NET Runtime 5? And should it be necessary in the first place? Does .NET Runtime 5 not include Encoding.UTF8?
Thanks.
EDIT: There is nothing wrong with this code. This is a question of framework dependencies or interrelations.
Reinstalling the .NET Framework on the server ultimately fixed this.
My Razor Pages project is experimental one. It is targeted on working with MySQL database for Visual Studio. Initially, I built the project on ASP .NET Core 2.2 and successfully upgraded to ASP.Net Core 3.1. Now I’m trying to migrate the project to ASP .NET Core 5.0.
After updating the project as recommended in Migrate from ASP.NET Core 3.1 to 5.0, I have encountered the following error in “Startup.cs” file:Fig.1
The next image depicts the error code:Fig 2
Installed packages list:Fig 3
I tried to do some things to fix the error:Fig.4
In the figure 4, you can see that I’m going to add a parameter. I added the one, which I set to “null”. The error eliminated but the problem remained. After successful project compilation, I started the project, but received the following error:Fig. 5
In the figure 5, you can see that the source of the error is “Pamelo.EntityFrameworkCore.MySql” and the message is “The Server Version has not been set”. However, why it has not been auto detected? Well, if the second parameter is not to be set to “null”, then how this parameter is to be set?
To answer this question really helped me the following article:Pomelo.EntityFrameworkCore.MySql
Now the “error” line works well and looks as follows
services.AddDbContext<ApplicationContext>(options => options.UseMySql(
connection,
new MySqlServerVersion(new Version(5, 7, 17))
));
The project works well, but questions remain. What can I do if I can’t find server version? Why auto detect does not work as in the earlier package version for ASP .NET Core 3.1? Why should I depend on the server version?
Returning to the figures 1 – 3, I have the question:
Should I expect that the original code (auto detect) would work after Pamelo.EntityFrameworkCore.MySql (v 5.0.0) package release version will be published?
Any help would be appreciated.
I'm trying to migrate my app from .NET Core 2.1 to .NET Core 3.0. I've seen Microsoft document regarding this kind of migration, but I've also seen 2 or 3 tutorials which are way shorter than it and are enough to migrate the app.
I started with changing the <TargetFramework> from netcoreapp2.1 to netcoreapp3.0. As expected, it caused a few issues regarding all the packages, but I resolved it by upgrading them or changing deprecated methods to another.
Now the things are getting weird. I tried to run the application, but got following error:
Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.0.0.0
OK, happens, not the first time I encounter some issue during this migration and probably not last. According to this topic found on Stack, it is because MvcJsonOptions has been removed in .NET Core 3.0. I tried to search for it in my application, but couldn't find any code. Guess it's some internal stuff then. Anyway, most upvoted solution was to update Swashbuckle to version 5.0, so I did. And here comes my troubles:
When I try to run the application, I get "Failed to bind to address http://localhost:5000". This is strange, because few minutes before I've just run this app but in .NET Core 2.1 and it worked perfectly fine. I have checked ports using netstat and port 5000 isn't used by anything. I'm using IIS Express.
When I change the host, I simply cannot run the application. It just loads forever. I've set some breakpoints, but everything looks fine - it just goes through all the code in the Startup.cs, but then it loads infinitely. What seems to be worse, I tried to change the port on another copy of my app, before migrating it to .NET Core 3.0 and it works perfectly fine. Just changed the numbers in appsettings.json and launchsettings.json and it works.
So in summary, my application fails to bind to my standard address after migrating it to .NET Core 3.0 and when I change it, something very strange is happening and it loads infinitely. Any ideas?
MvcJsonOptions has been removed in .net core 3.0. Try installing Newtonsoft.Json NuGet Package and build your project.
I am a beginner in .NET Core. I am learning Lynda's "Learn ASP.NET Core MVC The Basics" course. When I try to learn example code of Chapter 1, Video 5, this error appears:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681
After going through several questions on Stack Overflow, I find that it is caused due to the inclusion of older .NET Core Version (1.0) in the exercise files. But the Visual Studio in my computer has Version 2.1.4. The folder "wwwroot" in the exercise might also cause the issue.
It seems that the only way I can fix this issue is by downgrading to Version 1.0. But how can I do it? Do I have to uninstall Visual Studio Code and install it with .NET Core V 1.0?
"Downgrade" is not a feature that is supported in Visual Studio.
Option 1
Find a tutorial that uses .NET Core 2.0. Microsoft has really good tutorials and documentation, depending on what you want to cover.
.NET Core 1.0 was basically a beta that Microsoft called 1.0. You gain nothing by learning .NET Core 1.0 at this point due to its limited amount of functionality (and usefulness) compared to .NET Core 2.0.
.NET Core 2.1 is soon to be released as well.
Option 2
Create a new project that targets .NET Core 1.0 in Visual Studio 2017 and put all of your .NET Core 1.0 code there.
Choose ASP.NET Core Web Application and name the project. Click OK.
On the next screen, change the project to target .NET Core 1.0 from the dropdown. Choose any other options from the tutorial. Click OK.
Option 3
Retarget your .NET Core 2.0 project to .NET Core 1.0.
From Solution Explorer, right click the project and choose Edit <projectName>.csproj.
Change the TargetFramework element from netcoreapp2.0 to netcoreapp1.0.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
...
</Project>
Fix any compile issues that making this change will likely create. Every project will have different issues depending on what is referenced by the project. There is no guide for this, you need to do research to find out what the problems are and fix them yourself. Google is your friend.
NOTE: None of this will likely fix the underlying cause to your error message, which is a completely different Stack Overflow question than what you are asking here.