How to live code in .NET Core 3.1 application while using IIS server? - visual-studio

Recently I reinstalled my PC. I had my project hosted on IIS server, I remember that in Visual Studio I had to prepare IIS profile in debug options with hosting model OutOfProcess and then when I made some changes in code and hit refresh button in browser, project was automatically recompiling and giving me new results. It was basically live coding.
Ofc just refreshing page without any changes in code didn't trigger recompiling and browsing project was smooth.
I have no idea how did I achieve that, I was looking through internet for a while and coulnd't find solution. Every solution I found says to use dotnet watch run.
Right now I have same setup and it kinda works, but I have to hit compile every time I change something in order to see results on web which is really annoying.
Any idea how to achieve live coding with IIS?
EDIT:
I found the option I was looking for, but seems like it is set correctly and refresh doesn't trigger an rebuild.

I found partial solution, when I select:
Or:
It does work, however I think before it was working automaticaly without triggering an browser from VS. I'd appreciate any solution without it, however it is good enough for now.

Related

How to make this Foundation 6 website run in Visual Studio

In today's guessing game, I have inherited this website project from the previous inhabitant of my desk, but I don't know how to run this site within visual studio, or, for that matter, outside of visual studio. As far as I can tell, this website project is written with Foundation 6 and Handlebars, but the project structure doesn't exactly match the default templates that I have seen when looking at Foundation or Handlebars. The rest of the solution (not shown) runs just fine, with no issues, but it's not written like this. It's all the normal .aspx type stuff.
I've tried to set this website project as the Startup Project, but when it builds and runs I get a 403 error (Forbidden). If I simply try to browse to the default or index pages, I get (see image below). Something is definitely missing, but I don't know how to tell what. Also, we have this page active in a dev server, and it works just fine, but again, idk how, or how to find out how.
Any idea of what I'm missing or suggestions on what steps I need to take to troubleshoot to get this thing to launch properly?
Thanks!

Does Visual Studio Publish to Azure Website Cause Whole Site to Recycle?

We've recently launched a new website in Azure (i.e. Azure Websites) and as is typical with new launches we've had to deploy a few tweaks to fix minor issues shortly after launch.
We want to use Slots in the long run but this is not possible at the moment. Hence we are deploying to the live site. It's a fairly busy site with a good amount of traffic and obviously want to keep downtime to am minimum.
We are using Visual Studio to publish file changes to Azure but have noticed that even if we publish a relatively insignificant single file the whole site goes down and struggles to come back up. I was assuming that publishing a single file would literally just replace that file on the file system but it's behaving more like it recycles the application pool (or Azure equivalent) for the site. The type of files I've been publishing have been Razor views, hence would not typically cause a recycle.
Does anyone know what actually happens under the hood of VS Publish and if there is a way to avoid this happening?
Thanks.
I just tried this using a basically clean new MVC app (https://github.com/KuduApps/Dev14_Net46_Mvc5), and I did not see this behavior. The Index.html view has a hit count based on a static, which would tell us if the app or the page got restarted (or if that specific page got recompiled).
Then the test is to publish it, make a change to some other view (about.cshtml), and publish again. WHen doing this and hitting Index.cshtml, the count keeps going up, and there is minimal slowdown.
If you see it getting restarted after a view change, I suggest using Kudu Console to look at the files in site\wwwroot before/after the publish, and check what has a newer timestamp (e.g. check web.config, bin folder, ...).

Converting Web Site Project to Web Application Project

I recently changed my project from a Website Project to a Web Application project so I could use build events.
I'm having all sorts of problems now trying to develop.
When I build the project and reload it in the web browser, it hardly ever loads the right version (sometimes it does).
Like if I make a simple update to some text, it will load the last page, like it's using a cached version of the page or something.
Also when I try to debug, it will never hit the breakpoints. I'm not sure what I need to change to fix this issue, any help would be greatly appreciated.
What browser are you using? The chances are the pages are being cached. With most browsers you can do Ctrl + F5 to force a reload of the cached files.
In Internet Explorer, you can change the option for Temporary Internet Files to 'Every time I visit the webpage', but be aware that this affects all sites you visit.
If you are talking about changes to binaries, you might need to do an iisreset. If you are still having issues, try deleting ASP.NET temp files.

MVC3 Ap in Visual Studio 2010- Changed to use Local IIS Web Server and can not get it back to VS dev server

I changed from running Use Visual Studio Development Server to Local IIS Web Server becasue I read it would create the virtual directories properly - it did not - once I navigate out of the account area I get
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Requested URL
https://localhost:443/xxx/Index
Physical Path
C:\inetpub\wwwroot\xxx\Index
I have been googling and trying to get it to work, but can not and can no longer debug - Now I am trying to change it back and it keeps starting in Local IIS Web. I have HOSED myself and don't know where to go from here.
Thank you
In terms of getting back to using the VS web server you should just need to:
Right click on the web project in VS
Selection properties
Go to the web tab
Select "use visual studio web server" radio button
For the sake of not leaving questions unanswered, I tried all of the suggestions above, and many more, and got nowhere. I was in an early phase at the time, and I had to move on, so I ended up creating a new solution, and porting things over. Not the best idea, but I had to go forward, and I had taken enough time. It is still living on my machine, and I plan to go back and figure it out at some point. Hopefully, I'll have more understanding and will be able to post what I did wrong so someone else can save some time. Thanks all for attempting.

"No symbols have been loaded for this document." But they have!

As you can notice
Symbols are been correctly loaded.
I just created a view GetCompanies.cshtml using the AddView shortlink
But, no matter what I do, I can't debug in the View.
What I did so far:
Close and Open Solution
Close and open Visual Studio
Shutdown all ASP.NET Development Server's
Deleted all Symbol Libraries .pdb
Clean Solution
Re-Build Solution
did not (yet) shutdown Windows 7 x64 :-/
Sometimes if you have a hard stop, Visual Studio temp cache will be screwed.
Clear the cache by deleting these folders:
C:\Windows\Microsoft.NET\Framework\<.net version>\Temporary ASP.NET Files\(ApplicationName)
C:\Windows\Microsoft.NET\Framework64\<.net version>\Temporary ASP.NET Files\(ApplicationName)
I am finding the same behavior from time to time when debugging silverlight. My solution is to clean the browser's cache (on latest IE click on the wheel button, Developer tools), as it sometimes will cache the binary files and not load the new ones.
Perhaps is could be the same with your views?
Been messing with this problem for a couple hours trying everything above. I finally changed my Target Framework to .NET Framework4.5 and it all started magically working.
This is always weird. I just had this problem and solved it with a full rebuild of the entire solution.
There was also another strange symptom, though: a new unit test that I had written using NUnit, mocking with NSubstitute, wouldn't pass because NSubstitute wasn't returning what I wanted it to return. I lost a few minutes trying to figure out if I did something wrong programming NSubstitute, then when I tried to attach the debugger to the NUnit GUI I saw that warning.
That's when I decided to do a full rebuild of the solution, and that worked for me.
So I guess the lesson to be learned is "before smashing your head against the wall, try a full rebuild".
For me, I somehow switched my target build to Release instead of Debug
Remember that views are actually compiled when you request the page (by default).
This means when you set a breakpoint in a view:
It shows the "No Symbols" error. This just means the view isn't
compiled yet.
It shows the breakpoint fine. This just means
that it found SOME compiled version of the page. Like the LAST working version...
So basically its not meaningful information to look at what it says when you mouseover the breakpoint in a view (at least in this regard)
If you are trying to debug this page, then you have a problem. Look at what the debugger is outputting to your BROWSER instead and fix that first. I think we'll be surprised about how many people are going to facepalm at this.
I had this problem with SL5 project (VS2012). And to fix this, I was needed to set "Silverlight" option enabled in %MyProjectName%.Web project properties, under Web tab.
In my case, the .PDB file was hosed (from which the symbols are loaded) in VS 2012, so performing a Clean and Build reconstructed the .PDB file and everything started workign again.
I was attempting to debug a deployed WCF windows services (compiled in Release mode) and had the exact same issue. Give this a shot...
Save All. You may even want to try to clean the solution
Rebuild all and install or deploy
BEFORE starting the service (or exe) I copied the .pdb files over to the install folder
Start the service (or exe) and attach the debugger to the process
Worked like a charm (finally) for me.
delete bin and obj directories
run solution again.
Note: Unless that cshtml loads at runtime the symbols are not loaded. On page load that breakpoint will be hit. So wait till control goes to that page

Resources