Local Debugging IIS application on my laptop using using remote IIS applications (with Rider) - asp.net

I was witching and had my first few ASP.NET Razor Pages projects, debugging locally, publishing after, and everything went fine.
But now I temporarily took over a project from somebody with health issues, can not ask him things at the moment, maybe next month.
The projects run on two physical servers, five IIS-applications running, like API, Video-Handling, IndentityServer and a "WEB" for the user-interface. Endpoints defined in the "appsettings", I get it.
I changed some minor things at the User-Interface (WEB-Application), published it directly on the server and everything went fine. Pfff..
But... now I want to make some bigger changes and test them locally before publishing, but still using other unchanged IIS servers on the two servers, which do the "heavy-lifting". So I put some breakpoints like always, run "Debug" on Rider, express IIS server starts successfully, but I noticed the application redirects to the project on the remote server and then of course does not meet my breakpoints anymore, it is just running the old version on the server. Now I am missing something..., looked at several configuration files, how can I configure it, when it starts with the local IIS express server instead of the remote server? I want to stay on the local IIS express server, since I want to test the changes of course.
Hope I explained my issue well enough, did not know how to tell exactly.
Greetings to all!

Related

How does the view in browser option work in Visual Studio without IIS?

It seems like the View in Browser option doesn't really require IIS and it seems to process ASP pages fine. So how does it really work without a web server?
They used to have a developer web server (Cassini) which is dead long time back so is there some kind of built in capability in visual studio? Who processes the requests by asp pages if it doesn't require IIS?
I already have IIS installed so I am not sure if is servicing the pages but seems like it will work without IIS because I don't configure anything in IIS and new ASP.NET projects work out of the box as well View in Browser option for an asp page option which just directly executes that page.
Actually this is what occurs:
Your web web.config is copied.
Then VS spools up a WHOLE running copy of IIS (it is the express version - but it is the same for the most part as the full edition of II).
Once VS spools up and starts and configures that running copy of IIS?
Then your web page and web application can run. If you look at your system try, you see this:
So in above that 2nd from the left in the tray shows that blue thing icon. I have right clicked on it to show the options you see.
So now you have a running copy of IIS on your computer. So you ARE running a full web server here. (well, ok IIS express - but the base parts and what that means is much the same as the full edition).
Around about VS version 2010, they USED to have a smaller built in web server as part of VS. The problem of course was for Microsoft to maintain 100% compatibility was VERY hard. So while for a considerable time frame and history of VS? Yes, they had a built in web server as part of VS. But they dropped it a number of versions ago in VS, and as noted now use IIS express.
So Now? Well, when you install VS, they also install a working copy of IIS. (the express version). The express version is quite much the same as the full pop edition of IIS. What is removed is "most" if not "all" of the IIS management screens and setup. (and sometimes I wish they would just install that part too!).
Your experience thus that a copy of IIS is launched. Once launched IIS does keep running during your development process (depends on your VS config and setup). But, if you go file->close solution, then you find that IIS express then also shuts down.
So, to view that web page? Yes, VS does config, and then does spool up and start internet services and that web server. So this running of IIS on your computer is what allows those web pages to work and run correctly. As noted, while this is a copy of IIS, it is for the most part the same as the full edition - just with most of the management tools removed. As noted, you SHOULD see that new icon appear in the system tray.
And as noted, I believe around VS 2010, they made that switch from the VS built in IIS to that of now using IIS express edition. As noted, this change was made to ensure a greater probability that when coding and debugging your web site in VS, that the end result will be much the same when running a full edition.
I do find that over time, the production (web hosted site) does get so many config and tweaks and changes, that I now can't include my web.config file in the publish (can't risk overwriting the server production web.config). So, over time, we added things like https security certificates and installed them, and set them up for the production web site. I don't have those same security certificates setup on my local machine. And of course there are some virtual folders and few more things that exist on the production web site as opposed to the dev copy I use. So, it somewhat my fault to let the production web.config over time to become "different" then what I run local when coding and debugging the web site. So now, when I publish - I remove the web.config file before I actually copy the new updated web application to the final production server (which of course is running the full edition of IIS).
But to make a long story short?
Yes, a whole copy of IIS web server is configured for you, and that whole copy of IIS is spooled up, launched, and once that occurs, then your web page option "view in browser" can run. But make no mistake here - IIS services is setup, is started, and is running for that web page preview to occur.

IIS serving an old version of files

I am developing an ASP.NET application and deploying to an IIS 7 server via WebDeploy. This is a single server (no web farm or anything like this). I've been using the same setup for two years with no problems. Since last night, the server seems to be "stuck" on the last version of the web that I deployed before dinner. I deployed a couple of new versions today, but the server keeps serving the old pages.
I have triple checked this. When I log into the server via RDP and I open a specific ASPX file, I can see that it's the new version I've just deployed, so the server is actually storing the new versions. However, when I visit the web site over HTTP from my computer, I get the old version of the file.
I have restarted the server (the whole machine, not just IIS). I have disabled the IIS cache. I have disabled the compression cache. I have tried from multiple client computers, including one from which I had never ever visited this site (so no client cache may exist). But nothing worked.
I am aware that similar issues have been reported, and I have read some posts about it. But I seem to have exhausted all possible checks. Any ideas on how to proceed? Thanks.
After much struggling, I managed to solve this issue. I deleted the whole web site from the server, and I deployed it from a computer other than my usual development machine. This fixed the issue.
However, I am still baffled at why this happened. It must have been a glitch with WebDeploy and/or IIS.

Changing Web Service from Localhost to Server

I've got a small WCF service I've created.
I can edit it and get it working great on the localhost, but my PC is not where this application is going to be run from. It is going to run on our Server.
However, every time I try making any kind of change to the project that points it to our server, the entire project goes to crap: I can no longer view the project in a browser and my test console application can not connect to it. I try changing it back to using the local IIS web server, but then the local machine does not start up IIS whenever the project is started so it doesn't work either.
I can debug and troubleshoot for a day or so to get it working again on the local machine, but then I'm back to Square 1 where I need to deploy my application onto our Server.
This is freakin' maddening!
My project works, but I can't seem to get it from Localhost to a real Server.
All the examples I find online show how to do this using Localhost. Does no one ever deploy their projects?
Where is the Guide for getting me from Development stage to Deploy?
Some nice tutorials here
http://www.dotnetspider.com/forum/193466-Deploy-Wcf-service-IIS.aspx
http://wcftutorial.net/WCF-IIS-Hosting.aspx
also on SO Deploy WCF Service to IIS when it only has an App.config
Also a video on youtube http://www.youtube.com/watch?v=mX8quq7MoeI

As an ASP.NET Web Developer using Visual Studio, should I have IIS installed?

We do ASP.NET Development using Visual Studio.
A discussion point we've just had is whether or not our developers should have IIS installed.
With the ASP.NET Development Server you can run your web apps without IIS. Once you're happy with everything you can then deploy it to a test server running IIS and then onto Live.
In my opinion, all developers should also have IIS installed on their own machines as that will eventually be the end platform for the application.
The arguments are basically if the developer should have as close to "live" an environment as possible, or if the developer should only have the tools they require and not be cluttered with other things.
None of this is missions critical and I'm sure everyone will have a differing opinion. I'm just interested to hear some of them!
Robin
I'm going to say unequivocally yes. IIS and Cassini are not the same and not exposing your code to production conditions can cause you problems. Better to get yourself in the habit as early as possible.
(obviously you can replace "IIS" with "Apache" or whatever your webserver tech is)
I would say that you don't need to have IIS installed, but that you should test on IIS at some point.
The Development Web Server has two "issues":
it only works for local requests
ALL requests are passed through ASP.net
Especially the second point can really open ways to shoot you in the foot. "Why can people access SuperSecretPicture.jpg? I have a Handler in my Web.config that blocks that!".
But if you know about those limitations, then I find that the Development Web Server is better to start with since you can first focus on your code and then about your environment, but YMMV.
The bottom line is if your application is served by IIS, you should be testing on IIS. If that means IIS on your local machine or a dev server is up to you.
What harm can it do having it installed? At least if you have it installed you can choose to use it or not. The day you need to debug a webservice call from an externally hosted application you don't want to be messing around installing it.
Depends - are you running server versions of windows for you dev boxes?
Because, e.g. the XP version of IIS is different from 2000/2003 server, so you'll get a different experience. Similarly, if you develop on Vista but plan to deploy on 2003, it won't be a "complete" experience.
We have IIS installed on our local machines at our work for development purposes. We need to test the web applications against IIS, but neither do we want to release it to our live server, or to our test server as that requires a lot of work. Instead, we just host it locally and everytime we modify a file through Visual Studio we can then instantly see the changes without having to go through a file copying process.
I don't think it's a bad thing at all, as long as everything's secure you'll be fine.
Ideally your test server should mirror your production server. That should go without saying. In my opinion, your dev environment should come as close as possible, while fulfilling your needs first (I prefer to keep the dev environment as self-sustaining as possible, in case I am disconnected from the network).
I have no problem using the dev server for development, and IIS (locally or remote, as the case may be) for testing - but it depends on the project requirements too. I prefer to host web services on the local IIS server, for example. YMMV.
We develop on laptops using virtual machines. This way, if the virtual OS crashes (or the host OS, for that matter) you just copy your vpc back over from the network (where we have backups) and you are good to go. also, it makes it WAY easier to run a "standard" development platform wich is as close to production as possible.
For us, we HAVE to have IIS installed, as we are developing Sharepoint '07 webparts.

ASP.Net Web Site Won't Compile, But Works Anyway?

I have an ASP.Net 2.0 web site, using the DotNetNuke framework (4.09), and it will not compile, but when I hit the site in a browser, it works. Even the parts that don't compile will work. How is IIS able to compile and run this site, when Visual Studio can't? Everything is the same in both places... I copied the entire web site from the remote server on to my local machine, then I set it up in IIS the same way. On my local machine, Visual Studio can't compile the site, but it still runs. How can this be possible?
The specific errors are not important, as there are 189 of them, from every possible part of the site. I'm not trying to fix the errors... what I want to know is how it's possible for the web server to run the site, regardless of the errors. Please pay attention to what I have written - everything is exactly the same in both places. There are no missing DLLs, no different configurations, nothing on the machine itself... remember, the site runs fine on my local machine.
Is this a web site or a web application? If it's a web application, you're probably still running off the last successfully built bits in the bin.
The site is using old dlls, or possibly you have references missing in your local version that the server has just fine.
As Mitchel said, we need to see the error before we can really answer your question.
To give you an answer on this we would need to know what the errors are.
Your local machine cached the 'working' copy and is using that maybe?
The site was compiled successfully at one point as it works on the remote server. Thus, copying it to your local machine and hitting the local site will also work. However, there can be several reason why you can't re-compile it on your local machine including; missing references, web.config entries, third party control licensing, etc..
I realize you are not trying to correct the 189 errors, but there are clues, if not answers, in the error listing that will get you moving in the right direction.

Resources