I am debugging a large web application solution, with the main web application project as a single startup project, configured to use IIS for debugging. Whenever I run this application inside Visual Studio 2010, I still get multiple instances (sometimes over 15) of the ASP.NET Development Server starting up as well. Why does this occur?
Visual Studio has a setting in every Web Project's properties by default to start the development server when you are debugging. This enables, for example, a web project which contains Web Services to be available when you've selected a client web site or application to start.
If you do not want this behaviour follow these steps:
Select the web project
Open the "Properties" window by pressing F4
Change the Always Start When Debugging value to False
Repeat steps 1-3 for any other web projects in your solution
Source: '"Always Start When Debugging" – Preventing multiple Visual Studio Development Servers from starting' by by Kevin Rintoul
A simple solution if you have many web projects in the same solution: from the Package Manager console:
get-project -all | %{ $_.Properties | ?{ $_.Name -eq "WebApplication.StartWebServerOnDebug" } | %{ $_.Value = $False} }
This will change all web projects Always Start When Debugging setting to false with a single command.
My setup is similar to yours (except I use CassiniDev ( http://cassinidev.codeplex.com/ ))
Go to all your secondary sites project properties : click "use Custom Web Server", set something in "Server Url" (for exemple http://your-iis-server:your_port/your_project, but it may be even invalid)..
This will prevent the automatic startup of Cassini for the secondary web sites.
Leave your main site in the original configuration.
Related
I am trying to debug a project I inherited. This basically consists of an ASP.NET website hosted in IIS (local IIS not express though), and a number of other projects for example a project containing the model, another project containing the Data Access, another project containing control classes etc.
I have added the ASP.NET IIS hosted website to my Visual Studio solution by Right Clicking Solution > Add > Add Existing Website ...
When I debug the website (by setting it as the startup project) from Visual Studio, it launches and works OK so for example I manage to connect to the Web Services hosted on another server, login etc etc.
However I am finding problems to hit the breakpoints on the other projects, such as XXX.Web.Model, which contains source code I need to debug.
What settings can I modify to hit the breakpoints? I tried attaching w3wp.exe but to no avail.
You might need to set multiple startup projects, and for each of the projects you want to debug set it to 'Start with debugging'. To do that on the solution node in Solution Explorer right click and choose Properties then in the dialog go to the Startup Project tab. As shown in the image below.
Docs are over at https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2017 .
We have a simple Visual Studio solution containing 2 projects:
A.) Simple ASP.Net website
B.) RESTful web service hosted in another ASP.Net application
We want to simply start the projects in Debug mode (F5) and have A consume data from B through Ajax. We do not have the possibility to configure IIS on all development machines (because some of them are on the client's side). The problem might be that JavaScript needs to be in the same domain as the URL it posts to.
Is there any way we can use Visual Studio 2010 Development Server to start both applications simultaneously in debug mode on the same port?
If this is not possible, what is the next best thing you can recommend?
We solved this problem by installing IIS on the development workstation.
In each Visual Studio project, on the Web property page, select Use Local IIS Web server.
Do not check Use IIS Express. The Project URLs will be set to http:localhost/<projectname> (note: in the same domain). You’ll be prompted to Create a Virtual Directory for each. Each will be assigned to the default IIS app pool. Open the Internet Information Services (IIS) Manager. Click Application Pools on the left pane. On the right pane add another integrated application pool. For one of the applications, open the Advanced Settings... In the properties view select the app pool you just created as the application pool. The applications should be debuggable in parallel because each Application Pool spawns a new operating system process to which a separate debugger can be attached.
Yo won't be able to host different apps on the same port within a Cassini instance, there are tools that might be useful but I would leave Cassini host them on different ports which is its regular behavior.
Options are (not tested):
UltiDev
Cassini Extesion
By the way, not sure if you know this, but to start both projects go to Set startup projects, there's an option on the Solution context menu.
On my Windows XP desktop, I have a fairly simple ASP.NET targetting .net 4 in Visual Studio 2010. I can run it on my local host by ctrl + F5, it works all fine.
I have a Windows Server 2003, that I can access via mstsc, but also via Explorer. When I go to the publish section of my build properties, i see 4 publish methods :
Web Deploy, FTP, File System, FPSE
I have already installed IIS 6 successfully on the Windows Server, and given all authorizations for everything I could so far (to get things to work in the first place, will check on that later).
How should I proceed to publish to that remote machine ? Should I target a specific folder ? Do I need to setup things in IIS 6 for that site first ? Or will it all get settled from te properties I have in Visual Studio ?
Thank you guys,
J.
Personally I've always plumped for a manual deployment; that is I create the Web Site in IIS creating an appropriate AppPool and targeting the correct .NET version to utilise. From there simply copy (xcopy if you will) the appropriate files over, e.g. DLL and all supporting pages such as ASPX, CSS and associated images. In most situations where I have direct / RDP access this is what I run with.
That said, this can be automated from Visual Studio and this can be useful for those situations where you're maintaining an awful lot of sites on a regular basis. With IIS 6 and Visual Studio, this was achieved by installing FrontPage Extensions on the server then utilising the Publish option.
For VS2010 it seems this has been streamlined using the IIS Web Deploy module and configuring the Studio to publish in this manner that looks mildly quick...
HTH
I've never used the Web Deploy feature in 2010, so I can't really tell you about its merits or drawbacks. I've read that it works much better with IIS7 than IIS6. If you have direct access to the IIS root folder on the server (typically c:\inetpub\wwwroot) through a network share I would recommend doing the file system deployment. FPSE works as well if you have to publish to the server through a remote URL, but there are some security issues with FPSE that make enabling it on your web server a less than ideal choice.
Once the files have been deployed, all that should be left is to configure the website as an application inside of IIS.
Remote in to the web server and open IIS
Right-click Default Web Site and choose properties (if you've deployed to a subfolder in the root, then locate that folder and choose those properties instead
Switch to the Home Directory tab (Just 'Directory' for a subfolder)
Look for the Application Settings section and click the button that says Create
Optional: Select an app pool if you have created a custom one from the default
That should enable IIS to execute your .aspx files inside of your application. Once you've successfully configured the app for the first time, you can just keep publishing your app to the same location over and over without having to reconfigure it.
I have a solution with a few projects in it, one of which is a web site. When I run one of the non-web projects (e.g. a console app), the ASP.NET Development Server starts up anyway.
I'm sure there was an option for this somewhere - how do I make the ASP.NET Development Server start only if I am running the web project?
Yes, if you select the project, there is a start when debugging option (or similarly named) in the project properties window in VS; setting this to false disables this.
HTH.
I have a solution file containing multiple web applications and components. Mostly these web applications operate independently of one another, but I need to be able to response.redirect from one application to another. This works, and the new page runs, but I can't step into the code in the second web app and debug it.
I have both web applications set to "Always Start When Debugging" = True, with the first web app (the one that's redirecting) set as the startup web application. Does anyone know a trick that will let me step into the code in the second web application?
Open up a second instance of Visual Studio, then Ctrl+Alt+P (menu Tools > Attach to Process) then attach to the appropriate web server process (if you run under IIS this may be w3wp.exe or aspnet_wp IIRC, if you use the built in web server then attach to the process which lists the appropriate port for your project).
Optionally just run the second one and manually go to the first one in your browser by entering the appropriate address and trigger the redirect which you have verified is working.
Are both web applications running in the same process? What version of ASP.Net, IIS, and the .Net framework are you using? Those are my initial questions before I start giving other ideas.