ASP.NET Core 3.1 app on IIS Express: “This site can't be reached” and "The connection was reset" - asp.net-core

I have developed ASP.NET project in Visual Studio 2019. When I try to run the project with IIS Express, the webpage says “This site can't be reached” and "The connection was reset".
In taskbar I can see that IIS Express is working and I'm able to debug and step though my code till the very end successfully so I know the service is executing fine without any errors.
Site can`t be reached
I created a new project, just to ensure that there weren't any errors within my config or build files. When I run the new project, I get the same result.
I tried with other browsers as well, but still the same error.
I repaired the Visual Studio using the Visual Studio Installer, and reset everything to default, and had no success with that.
I tried to delete hidden vs. folder and had no success.
Any advice on how to resolve this would be greatly appreciated.
Thanks!

I fixed the issue by deleting Kaspersky Antivirus.

Related

browser shows a blank screen when an asp.net core mvc application is run

I have created an asp.net core mvc web application in visual studio 2019 professional edition. After a successful build when I run the application, I am getting a blank screen in the browser. It is not showing the contents of the index page.
I checked the iis by typing inetmgr in the command window. It is opening up the iis Window. I also cross-checked in the browser window by typing http://localhost/. I am able to get the welcome page in IIS.
I don't know what's the issue here. Any valuable help is appreciated.
Please find the screenshot below.
When I faced a similar issue, it was due to the Web.config file, when the run httpRuntime was set to an incorrect target framework. Maybe remove the targetFramework parameter and see if the auto resolver resolves it.

Running winforms client, does not start iisexpress with the referenced wcf service - under Windows 10. Ideas?

I have a vs solution with 2 projects - WinForms client, and WCF Service.
Since visual studio 2013 to 2019 (I was under Windows 7), every time when I ran in debug the WinForm client, VS automatically was starting the IISExpress in background(I want that!), and my calls from the client were successful, stopping on breakpoints inside the WCF service easy.
Last week, I got new box with Windows 10. Now when I start the client, there is no iisexpress.
The source code is the same and not changed - my co-workers are under Windows 7 and this works for them - same code - we use git as version control.
The only time I see iisexpress is if I do "Update Service Reference" or I make the WCF startup project and run it.
Can you help me identify why this functionality stopped working? Ideas for a fix?
Windows 10, Visual Studio 2019 Enterprise, .NET 4.6
EDIT: I do not have problem running the webservice in IISExpress, when i specifically run it - it works, also on solution level if I set 2 startup projects, all will work. The main issue is that with Single Startup project - thw WinForms client, Visual Studio will not bring up the IISExpress instance. It is only development time issue, and this works for my co-workers.
The solution is in the VS generated (regenerated if missing) user file in the WCF project
.csproj.user
there is property
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
It must be True, but now it is defaulted to False.
The *.user files do not go to version control, and if they are missing VS regenerates them, hence my coworkers had it, and my freshly cloned repo did not.
I'm pretty sure I never touched this file or did any configs like that on the WCF project, my suspicion is that MS decided to start defaulting to False in some version or patch.
WARNING! After changing the option, close/open the entire solution or restart VS.
Disclaimer: I found this solution in the build in VS report problem button leading to a portal with reported problems and solutions. I do not see how to copy link or anything from that Feedback tool, but this is the guy that deserves the credit: 佐々木隆幸
It seems that you want to debug the WinForms application separately regardless of the WCF application. we could set up the project dependencies in the property page of the VS solution.
Then open the SVC file, press F5 to launch the WCF application so that we can add service reference in WinForms application.
Please ensure the below configuration in the property page of the WCF application project.
Besides, if there is something wrong with the IISExpress, we could opt to repair the IISExpress in the below dialog.
On my side, it works like a charm.
Feel free to let me know if the problem still exists.

How to locally run .Net Core 2.0 app in VS Code the same way Visual Studio does with SSL

So, we have a web app we've migrated to .net core, and while it runs fine in Visual Studio 2017, because Visual Studio uses its "launchSettings.json" file to configure how IIS Express will work/launch - I, for the life of me, cannot figure out how to get VS Code to run the project. The problem is, we use HTTPS only and have always just let IIS Express used the self-signed locahost cert to allow this, so when debugging the site locally, we'd always use https://localhost:44300. As stated, this worked fine when entering this url in the launchSerttings.json file for Visual Studio, but VS Code does not use this, and the only answers I can find on this always refer to having to use the Kestrel Server's .Listen() method and used a self-signed cert and password to allow the use of an HTTPS port. 1) this seems just silly that I'd have to add this "test" code to run it locally, because I don't need it when we deploy to Azure, as Azure manages the certs and url for us. 2) Visual Studio 2017 does not need any specification on Kestrel to make this all work. So, I have hard time believing there isn't some extension, or process to achieve the same thing in Visual Studio Code that Visual Studio is doing under the hood to allow IIS Express to communicate with the .Net Core Kestrel Server.
Combing through the all the documentation suggests that the ASPNetCoreModule is what handles this communication for IIS and Kestrel, so, I would hope/guess there has to be some way to configure the web.config file's tag to include something that would make this work.
I've previously used and tried other IIS execution extensions in VS Code, but those focus on elements in the project's web.config to boot IIS which are no longer present in the web.config due to it being a .Net Core app. I had been successfully running the web app with the IIS Express Executor extension before migrating to .Net Core when the web app was a .NET Framework 4.5.2 app
So, the end goal is that I need to be able to go to https://localhost:44300 in the browser, and have our site work, but I don't want to have to add any sort of test-cert into the Kestrel config in the Program.cs or Startup.cs files. If there's no way to do this, then that will be really disappointing considering Visual Studio makes this seem like it should be very simple.
Thanks for the help.
Was able to get this to work using the following steps.
1) Install IIS Express executer in VS Code or any other similiar extension that wraps around dotnet commands
2) Download Process Explorer from https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
3) Launch Visual Studio IIS Express as you would normally
4) Open Process Explorer (may need to launch as Admin) and locate iisexpress.exe -> VSIISExeLauncher.exe
5) Right click VSIISExeLauncher.exe and click properties then locate the "Environment" tab. Inside the environment tab you will see 2 variables: LAUNCHER_PATH and LAUNCHER_ARGS. Copy both of these variables and values.
6) Next locate the configuration file for the extension you installed in VS code (mine is launch.json inside the .vscode folder in your project root directory). It will likely have an "environment" or "env" section for adding environment variables to the launch arguments. Add the two arguments copied from step 5. These vary from person to person so the value of the arguments will be unique to your machine.
7) Launch IIS-Express from vs code. My particular command for this is "IIS-EE: Start IIS Express Server" but will vary based on the extension you installed. You can hit F1 to launch commands.
Visual Studio itself uses too many tricks under the hood to make you believe it is simple. However, it is not.
I documented all necessary details in a blog post,
https://blog.lextudio.com/how-visual-studio-launches-iis-express-to-debug-asp-net-core-apps-d7fd3677e3c3
And if you follow the steps manually, you should be able to launch IIS Express the same way VS does, and then use that in Visual Studio Code. I know there is some VSCode extensions trying to integrate with IIS and IIS Express, but I do hope those authors spend more time learning such integration and improve their extensions to fully support the scenarios.

.NET Core 2.0 (Preview) HTTPS endpoint error

So I installed VS2017 v15.3 to try out the new .NET Core 2.0.
Created a new "Web Application" project with Individual Authentication option. Ran the project, registered.
Now it all seems to be fine, but then I tried to create a new class for my database, tried to add migration, and then I got the message:
Unable to configure HTTPS endpoint. For information on configuring
HTTPS see https://go.microsoft.com/fwlink/?linkid=848054
So I followed the steps on the documentation, but with no positive results.
I found out that IIS was not installed on my computer, so I added the feature in windows - so I can import a certificate as per doc. - but that doesn't work either.
I'm not new in VS, but I'm not really familiar with the configuration options.
Currently I managed to somehow mess up everything, and even on a new project when hitting Ctrl+F5 under IIS Express, I just get a "This site can’t be reached" error message.
Any advice please?

WCF Azure 403 error when running locally

I'm stumped. There are several threads out there that reference a similar problem, but not the same one. I'm trying to get a simple WCF service up and running in Azure, but my problem is happening before I even deploy. I'm following this article:
https://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-create-deploy/
Which says to create your project, build the "Hello World" service interface and class, and then start your project locally. I get a 403 error when I try to start my project.
The only step I'm not following exactly is that I don't have a "Start Without Debugging" option (I'm using Visual Studio Express Web Developer), so I just push "Start Debugging."
Why would I get a 403 error on my own machine? I am running Visual Studio as Administrator.
On the WebRole project right click on your .svc (Service1.svc) and choose "Set As Start Page" And then run the project. Make sure to do this on the WebRole project not the Azure Cloude Project.
Is the Azure project the default project or is the WCF Web Role? If it's the role itself, that may be your issue - it's trying to access the root of virtual directory containing the web service versus running the cloud app in the local emulator. If you browse to http://127.0.0.1:81/Service1.svc in a new browser window do you still get the 403?
It seems VS has lost the its project settings. Bring up "Properties" page on the web service in VS. Go to the "Debug" tab. Under Servers/Virtual Path: my configuration was set to just "/". Put the name of your server back in there "/Service1.svc" and it should work from the debugger now. This fixed the problem for me.
The problem went away when I upgraded to VS 2010 Pro. I never fixed it on Express, but after upgrading the problem was gone ... I had the "Start without Debugging" option in the Pro edition, so I suspect that the problem may have been specific to Express.