Can't debug in Visual Studio when using local IIS WITH hostname - iis

I have a solution that contains multiple projects, two of which are web applications that have their own separate domains. I have this published successfully to my dev/production environment fine and now would like to mirror these settings across to my local machine for better testing.
I have configured the project to run under Local IIS and enter the required Url for both projects and hit debug, I'm then presented with the following error:
Unable to start debugging on the web server.
Invalid access to memory location.
Interestingly if I change my IIS configuration and remove the hostname and change the port to 81/82 (and reflect these changes in VS) then I can successfully start debugging my application.
This is more of an irritation than anything else as I can work without the custom hostnames and configure the rest of IIS perfectly, however this does get in the way of logging into both systems simultaneously.
I tried a number of recommended fixes such as:
Ensured app pool is running
Restarted Visual Studio
Restarted computer
Run VS as Administrator

Related

Attempting to install NuGet server on iis 10 on w2016 yields 404 not found error

My environment:
Windows 10 Creator (1703 with current updates to this date)
Visual Studio 2017, Enterprise, 15.3 with most of the goodies turned on.
Windows 2016, again with all current updates.
iis 10 with WebDeploy installed (that's a whole other installation nightmare, suffice it to say that SO helped there and the answers are already out there so I won't go into it here). Turned on ASP.NET 4.6, otherwise mainly accepted the defaults.
My process:
As per the NuGet.Server documentation, create a new ASP.NET MVC project using the "Empty" template and download and install NuGet.Server as specified. I'm using .NET 4.7 as my framework.
Compile and configure as desired (at least ensure you have an api key in place).
Deploy to iis using the "Publish" | Web Deploy option
Try to get in touch with the NuGet.Server on the website and fail miserably!
My bindings are 192.168.1.25 (yes, the server has a fixed IP address), port 80. The name of the site is AWENuGet and the desired url is www.awenuget.com.
To be sure, all of this works just fine if you take the same project as described above, assign a local port number (creating the project will do that anyway) and then simply running the application in Visual Studio works just fine.
But, when I took that self-same project and simply deployed it to iis, miserable failure.
I tried to open the host file (Windows\System 32\drivers\etc) and added the following:
192.168.1.25 www.awenuget.com
to said file and it still failed.
...and the answer, for me, was to take that same hosts file entry that I made on the server so that the server could see it and install it in my dev machine's hosts file and voila! NOW it works just fine.

Unable to remote debug asp.net mvc core application on IIS8 (AWS EC2)

I have an MVC core website written in C# which is deployed to an AWS EC2 Instance with Windows Server 2012 R2 and IIS8 deployed on it.
I am trying to remote debug the application as I am getting errors thrown which I don't when running locally (details for another post maybe).
On AWS Console, I have a security group with the following Rules as guided by here:
and when I click on Debug->Attach to process, and browse to my AWS instance, I can see the correct dnx.exe process, however, when I attach to that process,
I get the The breakpoint will not currently be hit. No symbols have been loaded for this document
I've tried going to Tools->Options->Debugging->Symbols and clicking Load all symbols as it is my understanding that since VS2012 the symbols do not need to be deployed, but rather just on the local machine doing the debugging, taken from here.
In versions of Visual Studio before VS 2012, debugging managed code on a remote device required that the symbol files were also located on the remote machine. This is no longer the case. All symbol files must be located on the local machine or in a location specified in the Debugging / Symbols page of the Visual Studio Options dialog box. See .NET Remote Symbol Loading Changes in Visual Studio 2012 and 2013 on the Microsoft Application Lifecycle blog.
I can see the connections being initiated in the MSVSMON process on the EC2 instance.
I feel like I'm close but I'm just missing one simple thing.
You need to check on which port the Remote Debugger is running and allow inbound traffic on that port by opening Inbound Port [4024 in my case] with a Custom TCP Rule for Remote Debugging.
You can check the port used by Remote Debugger at Tools > Options in the Remote Debugger Menu.

Debugging multi-site web applications in Visual Studio on Windows 8.1

I have a multi site Azure based web application. One site contains the web pages (with the view functionality driven through jQuery, Raphaƫl, and HTML) and a thin WCF service. The second site contains a more functional WCF service which in turn calls the data objects that call the database. We stopped development on the site a few years ago but it is still live for the few people who still enjoy using it.
Yesterday I had to fix an cross-site scripting vulnerability someone had reported on the site.
I was alarmed to find that I can no longer run the sites on my local machine under Visual Studio to test and debug any changes before deploying them to Azure.
Because of the interaction between the two WCF sites I had the local debugging set up as follows:
In the Internet Information Services Manager tool (InetMgr) I add additional websites with their physical path set to the location of the source code in the TFS local path on my machine.
I edit the host name in the site's binding to mimic the Azure location, i.e. the main site is projname.cloudapp.net:80 on Azure and projnamelocal.cloudapp.net:80 in my local IIS and the data WCF site is projname-wcf.cloudapp.net:8080 on Azure and projname-wcflocal.cloudapp.net:8080 in my local IIS. (N.B. The main site has a HTTPS binding too.)
I edit C:\Windows\System32\drivers\etc\hosts to include the lines
127.0.0.1 projnamelocal.cloudapp.net
127.0.0.1 projname-wcflocal.cloudapp.net
In Visual Studio I edit the web properties for the main site's project so that it uses the local IIS and project URL http://projname.cloudapp.net/ and I have a switch (in the code to say whether to call the local WCF or the live Azure one.
In the past when the project was under active development this set-up worked fine for locally testing and debugging. Yesterday it failed, one one machine http://projnamelocal.cloudapp.net/ gave a 503 error on another a 404. (N.B. I can ping each URL from the command line so the hosts redirect is working.) Visual Studio complains that it is "unable to start debugging on the web server" and that it "could not start ASP.NET debugging".
I've tried all the suggestions and some:
Running without debugging
Running Visual Studio as administrator (I was already)
Re-registering ASP
Changing the app pool
Giving everyone full permissions to the code directory
Running as my own domain account that is an admin on the local machine
Changing IE to not auto-detect proxies
Adding the sites to IE's list of trusted sites
Turning off IE's protected mode
Restarting Visual Studio
Restarting the PC
Restarting the PC again
How should I set-up this style of running, testing, and debugging local sites work in IIS under Visual Studio?
Got it.
I had forgotten to go to Control Panel > Programs > Turn Windows features on or off > .Net Framework 4.5 Advanced Services > WCF Services > HTTP Activation
Now that I have that installed the local sites start

IIS7.5 Debug vs Published permissions

I'm running Visual Studio 2010 and IIS 7.5
My site accesses a specified servers hardware for some statistical analysis.
When I debug my site in Visual Studio, I can access other servers hardware information with now issue. When I publish the site to IIS running as ASP.Net 4.0 appPool because the site is written under the 4.0 framework, the hardware retrieval fails. (note: when I run the site and analyze the local machine hardware, it works perfectly... the problem lies in analyzing another machine on the network.)
My question is, What is the difference in permissions a site is running under when debugging in Visual Studio in comparison to a published site in IIS 7.5?
Things I've tried...
Changing the app pool identity to every possible built in option, and my own domain profile, which is local admin on the machine I'm trying to retrieve hardware info about.
Changing the user that access the file directory of the website.
Changing app pools period. (The site has to run under .net 4.0, or else it barks out bad things).
I'm thinking I may need to install the site directly on the server that's being analyzed, but I find it odd that I can get all the data from other machine when I'm debugging. Any insight someone could bring would be greatly appreciated. Thanks!!
This answer is, in some cases, you have to add the appPool identity running the site to the "Performance Monitoring" group for the local machine in order to allow an ASP.NET site access the server's local hardware resources...

Development in IIS or Visual Studio internal webserver

Do you do local development/debugging with the internal webserver or a local iis install? I'm currently running the internal VS2010 webserver but it's so slow it hurts. I can see the page rendering in front of me...
I prefer to use Windows Server 2008 as my development machine so that I can use IIS 7 as the web server and just set the default location of the website to a locally mapped DNS name. This especially helps when testing code that is dependent on domain URIs and other information of that nature.
One problem I have experienced is an intermittence in the ability of studio to bind the debugger to the IIS processes. (sometimes a reboot is required to get studio to bind if this happens)

Resources