Visual Studio ASP.NET Launch settings - asp.net

can someone explain whats the difference between these settings?
The reason im asking: default pick was IIS Express and multiple processes used my logger and created duplicates in the log. But when i picked Project, there were no duplicates in the log.

The first is IIS Express that will use IIS Express to host this project and the second is Project that will run this project and debugging it.
If your project include Main that you can select Project to Launch and VisualStudio will debugging it.
The last one is Executable that will use the other application to run this project like dotnet run xx.dll and you should set the running application path when you select Executable and set some arguments. The VisualStudio will debugging the running application like use attached process.
See:Working with Environments and Launch Settings in ASP.NET Core
Use multiple environments in ASP.NET Core

Related

How to debug two web site projects that are in different solutions?

I have a solution A with a web site project that it needs to call another web site project B that is in another solution. I mean different visual studio instances
I don't know how to attach them to debug them at the same time like in a single trace.
Does anyone knows how can i do that?
Thanks
You can do this using two running Visual Studios:
You set up one of the projects in IIS and the other you can run out of Visual Studio directly then you can debug in both.
On the first project (the one running in IIS) you can 'Attach to a process' and attach to the w3wp worker process. See this:
Attach Debugger to IIS instance
Then in the second project just run the project using Debug --> Start Debugging option from the VS menu.
Optionally you can run them both out of IIS and attach to both processes.
Make sure you have debug allowed in your web.config files.
What i can think of is, you can deploy project B with pdb file onto a server and attach remote debugger to that server.

No symbols when attaching debugger to manually launched IISExpress instance

I've got a scenario where I want to launch a locally hosted service via IISExpress through the command line, and then debug it with Visual Studio. The problem comes when I attach a debugger to the IISExpress process, however, as it doesn't appear to be loading the symbols from my service's components.
The service is operational. I added some traces to verify that my local components are being run by the service. I just can't hit a break point.
Some information about my situation:
This is with Visual Studio 2015.
I'm using the /path option from IISExpress.exe, launching with minimum configuration possible.
This is an ASP.NET Web Api application.
Sometimes when the debugger attaches it shows the underlying dependencies (my assemblies), but I'm unable to load symbols from them as VS doesn't recognize the .pdb's I have on disc for them.
I found the application.config files for both my service and a service that was set up by Visual Studio. The files are configured differently, but they don't appear to be meaningfully different.
Most of the service's components are release builds and are deployed without symbols. One assembly is a debug build and does contain symbols.
The compilation tag's debug attribute seemed to have no effect on my ability to debug.
The idea here is to be able to pull a build from our build pipeline with a testing tool and load components from a local development project.
I discovered the problem after taking a closer look at the Debug -> Processes panel. It turns out that when IISExpress was initially being launched it was selecting the Native debugger by default instead of the Managed (4.6, 4.5, 4.0) debugger.
I installed and used EnvDTE80 to elect for which debugging engine I would like to attach with and everything worked like a charm!

Jenkins - MSBuild for ASP.NET CI without local IIS

Background: I am doing a POC for CI using Jenkins and MSBuild. I have installed Jenkins, MSBuild plugin and other required components on my machine and configured as well. But I don't have IIS configured on my development machine.
I want build the ASP.NET website and output the published code in a folder "c:\precompiledweb" using MSBuild script. I have
Can someone help me with MSBUild Script.
Make sure you read the prerequisites for functionality.
https://msdn.microsoft.com/en-us/library/1y1404zt.aspx
Walkthrough: Deploying a Web Site Project by Using the Publish Web Site Tool
Prerequisites
In order to complete this walkthrough, you will need the following:
Visual Studio.
*This walkthrough assumes that you selected the Web Development collection of settings when you started Visual Studio the first time. For more information, see How to: Select Web Development Environment Settings.
Access to Microsoft Internet Information Services (IIS) so that you can test the result of publishing a Web site project. In this walkthrough, it is assumed that you have IIS running on your own computer. Alternatively, you can use any instance of IIS for which you have permission to create a virtual directory.*
You need access to some IIS server.
On the flip side....you need to keep this general rule in mind. Jenkins is simply a fancy wrapper for command line calls.
So test the below (article) on your machine without IIS. If you can get the command line to work (outside of jenkins), most likely you can get it working (inside jenkins)
http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/command-line-deployment
Configure Source Code Management section, i.e. for TFS:
Add build step "Execute Windows batch command"
Insert msbuild invocation to your solution, i.e.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
"%WORKSPACE%\{solution_name}.sln"
You can add some optional parameters.
After build you can add another script invocation (batch, powershell, whatever) for copy project output to specific folder, but I would prefer another way: publish to IIS and run application immediately.
in Visual Studio create publish profile with WebDeploy target (help)
enable Web Deploy in IIS on test machine (help - when componentes are already installed go to "USING THE IIS MANAGER TO CONFIGURE WEB DEPLOY FOR A NON-ADMINISTRATOR" section)
add publish parameters to jenkins job from step 2, i.e.:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
"%WORKSPACE%\ {solution_name}.sln"
/P:DeployOnBuild=true
/p:PublishProfile="{publish_profile_filename}.pubxml"
/p:Configuration=Release
/p:Platform="Any CPU"
/p:Password={Password_for_publish_profile_same_as_used_in_VS}
And now you have jenkins click-once job for build and publish solution to test server. Add Source Code change trigger and you have basic CI.

How to run a test at the same time a web project is being debugged?

In some of the solutions we have ASP.NET/WCF web project and a test project. Some of the tests run against ASP.NET development web server using http://localhost:port/.... In VS2010 while the ASP.NET/WCF web project was being debugged, the test runner could run the tests and if there were any breakpoints in web project, the debugger would break the execution. This seems to have been disabled/removed in VS2012.
When the ASP.NET/WCF web project is debugged (launched by pressing F5 or via attach process), both the TEST->Run and TEST->Debug sub-menus are disabled. In VS2010 only Test->Debug sub-menus were disabled while Test->Run sub-menus were still enabled. We use this way to easily debug the services within the web project. Any way to get that behavior back or workaround?
Debugging While Running on ASP.NET Development Server doesn't seem to be applicable to VS2012 or at least I can't get it to work.
In VS2013 the situation is the same: the options for running / debugging tests are greyed out while the project is being run/debugged. This is a shame especially for projects like web API's where tests for calling the API via HTTP (as opposed to creating an instance of the Controller class and circumventing any network traffic) are very useful as they are closer to what the end users of the API will experience.
As a workaround, you can either open the same solution in a separate instance of VS, or create a separate solution with the same projects, specifically for testing. Debug in the first VS instance, run tests in the second one.
If you have a solution with WCF applications and tests calling them, you can debug the applications using the tests by calling Debug All Tests or Debug Selected Tests without a previous Start Debugging (F5).
Configure your solution to Multiple Startup Projects with None set in all actions and configure your WCF applications to the start action Don’t open a page. Wait for request. With this configuration the development web server starts if you select Debug All Tests or Debug Selected Tests.
Here is a workaround to debug a single unit test along with a web server. It relies on Debugging Multiple Processes (excludes MSVS Express):
Start web server (non-debug), note its process id (IIsExpress icon -> Show All Applications)
Place a breakpoint at first line in test
Start Debuging the Unit Test, wait for it to stop at the breakpoint.
Debug -> Attach To Process, enter web server process id
Both the test and server are running live in the debugger.
I ended up writing a quick addon. It turns out that like VS2012, VS2012 test runner can also run the tests when the web project is being debugged. It is just that menu options are disabled.
Try this:
Place a breakpoint in the first line of your unit test method.
Start debugging your unit test.
Once it hits the first line in your unit test, start a new instance of the other projects you need running.
This is not a pretty solution, but it works. Using Azure DevOps TFS Version Control, create a branch of your current project. Open the solution for your project, in the other branch, in another instance of Visual Studio at the same time as your main project is running in the first/original instance of Visual Studio. Then, run your web project in your first/main Visual Studio instance. Now, run your unit tests from the other instance of Visual Studio. Voila.
To keep them in sync, you can do Merges from one branch to the other.
I still ran into this on VS 2022.
If you have multiple projects you can run. Try to set the startup projects and set at least two of them. (solution->right click)
If two instances are running in debug mode, VS also allows you to start unit tests.
(I just started two aspnet api-s from my project)

sharpdevelop, asp.net and run/debug it?

i created an asp.net project in sharpdevelop. i wanted to get started to see how debugging is and i am stuck already. How do i run the ASP.NET project? It just says its configured as a DLL. How do i launch it as a webpage. I see "start browser in url" but how do i get my code in a webpage or what do i use to do it? Also can i debug while doing so like i would in MSVS?
SharpDevelop does not have great ASP.NET support. It does not have a visual web forms designer, for example. If you need that I suggest you look at using Microsoft's Visual Web Developer Express Edition.
To be able to run, view and debug your ASP.NET web project with SharpDevelop you can use the Cassini personal web server. There is a closed source version of Cassini from UltiDev which I have not used. There is also an open source version of Cassini for .NET 3.5 which I have used. The open source version does need you to compile it from source however.
Once you have Cassini compiled you can do one of the following to debug your ASP.NET web project in SharpDevelop:
1) In the project options (Debug tab) choose Start External Program and then browse to the Cassini executable.
In the Command line arguments field specify the command line arguments for Cassini, for example:
d:\Projects\MyAspNetProject 8080 /
(The first parameter should be the folder containing your web.config and Default.aspx web page. The second parameter is the port number that Cassini will listen on. The third parameter is the virtual root to use.)
Save these project options and then when you select Debug | Run or press F5 you should be able to run and debug your ASP.NET project.
2) Alternatively you can start Cassini manually, with the command line arguments as described above, and leave it running in the background.
Then in the project options select Start Browser in URL and enter the URL for Cassini, for example:
http://localhost:8080/
Since SharpDevelop 4.2 there is support asp.net mvc3.
For debugging you can use either iis or iisexpress

Resources