ERR_CONNECTION_RESET with SSL and ASP.NET - c#

So, this is my first time diving into ASP.NET. I've programmed in C# before (Unity), but I've never made a ASP.NET app. The problem is, I can't seem to get SSL to work! When I create a new project using these steps, I get the following error:
However, it works perfectly fine when I go to Properties > Debug and uncheck "Enable SSL". I've also tried using Microsoft Edge, but it gives the same error. Here is what I have tried to fix this:
Disable my antivirus software (Kaspersky) and restart Chrome
Restart my computer
Delete the applicationhost.config file in the .vs folder (source)
Delete the .vs folder and run a command (more info here)
Run VS Studio as Administrator
Delete a domain security policy in Chrome (more info here)
Do netsh http show iplisten - nothing was listed (source)
Repair IIS (Control Panel > Programs & Features > Select IIS > Repair)
Check if the port # was in the correct range (source)
Make sure there is only one certificate for localhost (source)
Follow the steps here
Uninstall and re-install IIS
LITERALLY UNINSTALL AND REINSTALL ASP.NET
Run in incognito mode (Chrome)
As you can see, I've tried everything that has come to my mind. Could somebody please explain why this is happening? To re-iterate, this happens when I don't change any of the default code you get by following these steps, so it can't be a timeout or something.
I'm using IIS Express 10.0 (iisexpress_amd64_en-US.msi from here) with .NET Core 5.0 and Visual Studio 19. As of now, everything is up to date.
I really, really hope you guys can help me with this!!! I would want to use https (because, ofc, its more secure than http).
EDIT: I have tried using Firefox, and who would've guessed? It's the same error. (PR_CONNECT_RESET_ERROR)

I ran into the same issue on a fresh Windows 10 and VS2019 install, for me this solved it
https://improveandrepeat.com/2020/05/recreate-the-self-signed-https-certificate-for-localhost-in-iis-express/
In short
Open cmd with admin rights
Navigate to “C:\Program Files (x86)\IIS Express”
Run IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:PORT/ -UseSelfSigned changing PORT for the port you're trying to use.

Related

HTTPS not starting in IIS when viewed from tray

I was working happily on my project. Then came a need to enable access to the server from remote machine (android) in LAN. I followed few answers on StackOverflow and they have completely ruined my project.
How to enable external request in IIS Express?
IISExpress returns a 503 error from remote machines
localhost refused to connect Error in visual studio
Earlier when I used to Debug using Visual Studio, I used to see two URLs, but I now I only see one. The debugging used to start in https://localhost:44373 but now https is just not starting and I get connection refused when I browse the https link. http link works fine.
I even tried to reset by following methods,
Deleted .vs\<project>\config\applicationConfig
Deleted IIS configuration rmdir /s /q "%userprofile%\Documents\IISExpress"
but none helped i.e. https is not starting even after using doing this as well
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:44373/ -UseSelfSigned
Please help. I am getting worried. My basic intent is to enable HTTPS and enable access to this https from remote machine.
If someone knows about good server where I can deploy website and easily do this, you may suggest as an alternative, but suggest a solution to current problem as well.
Close Visual Studio.
Following this link to Remove your IIS Development Certificate.
Now, Repair IIS from control panel.
Start Visual Studio. Things will start to work

asp.net core app deployed on iis meets 500 internal server error

:( Oops.
500 Internal Server Error
An error occurred while starting the application.
This message came out when I added database functionality to my asp.net core app and deployed it to iis. When I developed it in Visual Studio, everything went well. But after deploying, this error messages appeared.
I tried to use dotnet myapp.dll to run my app in the deploy folder, and found out it worked well. It is likely that the problem is relation to iis. I tried to add <compilation debug="true">..</compilation> to web.config, but it seems useless. What is problem are actually, or is there any other way to see the detailed error info to help find out what's happened?
Change stdoutLogEnabled="false" to true and then check the logs at stdoutLogFile=".\logs\stdout". The error(s) there might tell you something.
Check that you set up right Environment Name using ASPNETCORE_ENVIRONMENT environment variable as so use correct settings like connection string. On your machine by default you have "Development" environment.
You may use Error Handling middlewares for showing exceptions like
app.UseDeveloperExceptionPage();
Had the same issue. Here is the guide that helped me. Note, that I did not want to install the "Runtime" on the web server, but rather deploy all the necessary files as a stand alone app. Below are the steps in a more abbreviated form:
On your local PC, Determine which version to publish based on your server. I was targeting Windows Server 2008, R2 which meant i needed to publish win7-x64. Open a command prompt in your project directory and run the command below:
dotnet publish -c release -r win7-x64
This creates a publish folder containing hundreds of dlls, an .exe, and web.config located here: bin\Release\netcoreapp2.0\publish
On the web server with IIS, go to this landing page. Click the link for your desired version. Find the link for the Runtime and Hosting Bundle. Click to download and run.
Restart IIS by running this from an elevated command prompt:
net stop was
net start w3svc
Copy all of the files in your local publish folder to your desired application folder on the IIS server.
On the server, Open IIS, and create a separate AppPool and Application like normal. For the AppPool, under Basic Settings, change the .NET Framework version to No Managed Code. Make sure your Application in IIS points to your desired folder and the proper AppPool.
Test your web application in a browser.
In my case, I got this because I hadn't actually installed the latest 'DotNetCore.2.0.0-WindowsHosting.exe' on the windows server I was running it on... so it was working fine on my local machine in debug and error five hundy'ing on the server.
I had other non trivial to fix issues with the upgrade also... I'd advise avoiding it if you can.
Mark333's comment below solved my problem.
Quoting for easy reading:
"I'm using the normal publish provided by Visual Studio. And, I just
found out using the latest version of Hosting Bundle will fix the
issue. +1 on this
microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1"
I had to install for 1.1 since my app is a little older, but Hosting Bundle fixed it. In my case we deploy to a Docker image for our official environment, but when I want to do some testing locally I publish it and let my local IIS serve it up.
My problem was solved installing .netcore latest: https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-2.2.2-windows-hosting-bundle-installer
https://learn.microsoft.com/pt-br/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.2#install-the-net-core-hosting-bundle
Worked like a charm!
I had installed DotNetCore.2.0.5-WindowsHosting.exe on a Windows 2008 R2 Standard machine and encountered the same http 500 error. Logging didn't help (blank logs were generated - and Event Viewer logs were the generic ErrorCode = 0x80070002)
I had to do two things to solve my problem:
Give Read rights to the ApplicationPoolIdentity user (EG: IIS APPPOOL\AppPoolIdentityName) to the website directory and the application directory
I had to install IIS ASP Core under Server Manager (this felt weird, but it worked!)
I had the same issue.
My problem was that my connection string to db was not set in appsettings.production.json
And the internal server error 500 was to vague error message.
Changing the stdoutLogEnabled = true did nothing to me so i was not seeing any information about the error.
Make sure the App Pool has permissions to the folder where your app resides.
I experienced this issue. The problem was due to my local Sql Server instance. Remote connection were not allowed. So I manually restarted the SQL instance and my App restarted working fine.
I had similar issue after istalling dotnetcore-windowshosting using chocolatey while doing AWS ec2 instance bootstrapping.
When I checked my IIS modules AspNetCoreModule was missing.
This solved my issue. https://github.com/aspnet/IISIntegration/issues/434
I had to uninstall chocolatey package, restart machine and install it again.
Hope this helps!
In my case, I created a .NET 5 single file output, and I was getting:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
The problem turned out to be that the EXE file was for some strange reason recognized as a virus by the protection software (CrowdStrike Falcon). Re-building without "single file output" option solved that problem.
There is an article called "Configuring IIS, ASP.NET, and SQL Server" which I highly recommend.
I followed the steps described there and my asp.net core app now communicates with my SQL database (after being published to IIS):
https://www.codeproject.com/Articles/674930/Configuring-IIS-ASP-NET-and-SQL-Server
It also happens when you install dotnet-hosting-bundle/dotnet runtime beofore IIS.
In this case re-install dotnet-hosting-bundle/dotnet runtime.
To be able to see the excetion's detail I just needed to change the ASPNETCORE_ENVIRONMENT to "Development" in the "IIS Express" profile in the launchSettings.json file. I aldo needed to create the corresponding appsettings.Development.json file to set the variables and data needed in my App. When the environment is Development net core send the detail exception by defaul. As we can read here in the official documentation.

How can I test MVC changes by refreshing the browser?

I know there's a way to, in Visual Studio, test a change by getting the page running in the browser, and then by just refreshing the browser page rather than by rerunning the application. But although it was working before, it isn't working now, and I'm fairly new to MVC, so I don't remember what I was doing to make it work. Instead, I'm having to actually re-run the application each time.
Specifically, I 1) run from VS, 2) copy the URL from the webpage I just launched, 3) stop debugging from VS (and the browser closes), 4) paste that URL into a new browser window and hit enter, 5) get "This webpage is not available" from Chrome and "This page can't be displayed" from IE.
I'm using VS Express 2013, and was also using that when it was working. I've tried with both IE and Chrome, and I've rebooted my computer and cleared my cache. What did I do wrong / how do I fix it? Thanks!!
Install IIS locally on the machine you run visual studio on. Create a new site in IIS and point it's path to the path of your MVC project. Change the application pool for it to use .net 4 and set the identity on the application pool to your user account.
Then give it a binding of something like localdev and a host header in your hosts file, then just build the site and go to http colon localdev in the browser.
It will reset the app pool automatically when the build changes.
The way I build sites is I virtualize. I use Oracle VirtualBox and install windows server 2008 r2 (or windows 7 x64) to a virtual machine in virtual box. Then I install Sql Server 2014 and Visual Studio 2013. Then I install Toirtoise SVN and Visual SVN extensions and get the source code from our sub version server and set up websites in IIS similar to how we set them up in production. Then when I want to debug code I just attach the debugger to ws3p.exe.
I searched SO for an answer before, but couldn't find one until after I'd posted mine (doh!). This question has the answer I wanted. Default MVC5 Application will not run out of debug mode in browser VS Express 2013
The issue was that I couldn't edit code (I could edit cshtml) when the debugger was still running. You can disconnect the running debugger and still keep the IIS session active if you uncheck Project Properties / Web / Enable Edit and Continue.

C# ASP.NET can not reload web application

i can not reload the WebApplication project, i got this message error
i moved the server to another place, so the IP is changed.
i already change the ip on IIS and WebApp config
i already uninstall IIS and reinstall
i already use aspnet_reggis -i
but still i, can not reload the WebApplication.
thanks you in advance
PS: i m sure is because the IP configuration. it work well at my home, now i bring the computer to office...it not work anymore....nothing change just the IP my home is not the same like IP in my office
the error message says: the project web ESPTEMPS_WebApp is configured for IIS, the website is not found.
You most likely need to configure your IIS for your website.
here's a helpful link to do this: http://msdn.microsoft.com/en-us/library/cek8kw6e.aspx
Good luck,
Your application is configured to work with IIS, in your case, IIS is not installed in your system or maybe the developer used IIS Express when developing. (You need to install VS 2010 sp1 to get IIS Express 7.5 integration with VS)
What you can do is:
Close your solution and open the csproj file in notepad (of the project that is giving problems)
Find and set these values:
<UseIIS>False</UseIIS>
<UseIISExpress>False</UseIISExpress>
Then reopen your solution again with visual studio. You will be able to debug with the web developer web server.
I found a very good reference for you. It will walk your through set of steps to help you configure your IIS. Here is the link. Please ignore the steps that are not applicable to you. But basic idea is:
Open Project Properties and go to Web tab
Select local IIS web server. If it is already selected, it will show you a virtual directory. If it doesn't already show selected, then mention the virtual directory.

Metabase error when trying to use Visual Studios Profiler on an ASP.Net site

I'm trying to run the performance wizard on an ASP.Net website. However, whenever I try to start it I get the following error.
"The website contains unexpected information or you do not have permission to access the metabase. You must be a member of the Administrators group on the local computer to access the IIS matabase. Therefore, you cannot create or open a local IIS website. If you have Read, Write, and Modify Permissions for the folder where the files are located, you can create a file system website that points to the folder in order to proceed"
I am an Administrator on my machine. Tried googling but came up with nothing. Anyone run it before and know how to deal with it?
Update 2019: The link from msdn that answers this question is now a dead link, but can be found on wayback machine here:
https://web.archive.org/web/20160223061509/http://blogs.msdn.com/b/profiler/archive/2010/07/23/tip-fixing-vsperfaspnetcmd-metabase-errors.aspx.
This page says:
The information in the error is correct and it is worth checking to make sure that you are running from an elevated command prompt, but it does miss a common configuration issue. In order to query for information from the IIS metabase, certain IIS components need to be installed
To check this in Windows 7:
Open ‘Control Panel\Programs\Programs and Features’ (or run ‘appwiz.cpl’).
Choose ‘Turn Windows features on or off’.
In the ‘Internet Information Services’ section, make sure that the following options are selected.
The non-default options include:
IIS 6 Scripting Tools
IIS 6 WMI Compatibility
IIS Metabase and IIS 6 configuration compatibility
ASP.NET,
Windows Authentication
I was getting this error in Visual Studio 2012 on Win 8.1 64-bit and I already had the IIS 6 compatibility items installed.
To fix the issue, I had to make sure that Visual Studio was getting run as an Administrator. (Right click shortcut -> Properties -> Shortcut -> Advanced -> Run as administrator)

Categories