ASP.NET Debugging Multiple Projects - Error - c#

I have two seperate ASP.NET applications on the single solution. I change the startup order of projects from menu in order to debug them. Although the first ASP.NET application can start on debug mode, the second one gets an error like this:
"
Unable to start debugging on the web server. Unable to do an AutoAttach.
Make sure the server is operating correctly. Verify there are no syntax errors in web.config by doing a Debug.Start Without Debugging.You may also want to refer to the ASP.NET and ATLServer debugging topic in the online documentation"
How can I fix it?

Check the answer out here:
http://www.velocityreviews.com/forums/t65889-auto-attach-aspnet_wp-exe-in-visual-studio.html
Hope it helps
EDIT: Here's the text from the site as requested:
Since a default web application is OK and the problem only occurs in this
specific web application, please check the following settings of the
problem project.
Open the problem project in VS.NET IDE.
Select Project->"Project Name" Properties...
Select Configuration Properties->Debugging.
Please make sure the "Start Action" is set to "Start project" and the
"ASP.NET debugging" is enabled.

Related

Visual Studio 2019 .NET CORE and React Template Subsite

I am having a hard time getting this template to work as a subsite.
The steps that I took to create the project were:
Launch Visual Studio
Create a new project
Select ASP.NET Core Web Application
Gave the details for where the project should be stored, etc
Create
At this time I am not interested in redux so I just selected the "React.js A project template for creating an ASP.NET core application with React.js"
After that I thought that the steps to make this work at a sub-site would be:
Right-Click and Properties on the Web App Project, on the debug tab I set the App URL to what was there + /mysub, for example: http://localhost:57197/mysub
Inside the Client App Folder I modified package.json and set the "homepage" to "/mysub"
When I debug the application nothing renders in the browser. The browser's console shows that it is getting invalid characters when trying to load resources such as manifest.json, and even bundle.js, which tells me that the client side router is probably intercepting the requests for those files, and when I look at the network tab it looks pretty more obvious that is what is going on. The strange thing is though that tag does appear to be right and thus it is setting the %PUBLIC_URL% environment variable as I would expect, but for some reason it just will not work at this subsite location. I suspect that maybe there is more that I may need to do in Startup.cs, or even appsettings.json but I am not sure what that might be, or if even that is the route to go. Any suggestions would be great.

Launch ASP.NET website without debugging

In the default structure of ASP.NET 4.6.1 I was able, to set the IIS to run directly an application without the need of debugging or publishing it. But on ASP.NET 5 I couldn't manage to do so. I have tried to point the IIS to the wwwroot of the project and to enable "Produce outputs on build", but when i want to access the application I only get the following error:
HTTP-Fehler 502.3 - Bad Gateway
There was a connection error while trying to route the request.
Does anyone have experience with this or had a similar issue?
it's not available for right now , to do it we still need for IIS 10 but you can still do it with some trick check link below
your answer is here
Okay as I wasn't able to find any way to get this working, i spotted a little icon on top right next to "IIS Express" or "web", which is called "View in Browser".
Now you just need to go to the project's preferences, select Debug and choose IIS Express from the profile dropdown. Make sure, the checkbox at "Launch URL" is set and specify a App URL (Sometimes port 80 won't wor, so just choose any other one, for example localhost:5324) and then click on the icon like in the screenshot. Then you don't have to deploy the project or start debugging to see the project in action. Hopefully, this will be helpful to some of you.

The Breakpoint will not currently be hit. No symbols where loaded for this document

Windows 8, VS2013 IIS8,5
I'm trying to connect to a local WEB API by connecting to processes w3pv.exe (Managed (v4.0.30319), 19). The website front end and back end is both running fine on my local IIS. Right after publishing my x86 web API to the local IIS i try to connect to the process, where the break point states "The Breakpoints will not currently be hit. No symbols where loaded for this document". My colleague' can without any problems debug from his local computer.
So far I have.
Reinstalled VS2013.
Checked All Debug Properties
-Project -> build: Define DEBUG constant check / Define TRACE constant check.
Generate serialization assembly = Auto. Advanced build settings -> Debug info = full
Enable Just My Code: Check, Use Managed Compatibility Mode: Check
Enable Edit and Continue : Check
Made sure all Debug mode is set and all project Configured to Active solution platform x86, marked Debug and Build.
Deleted all bin and obj folders, as well as pdb folder in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
Reset IIS.
Set Select Code Type to Automatically determine the type of code to debug
Checked in IIS that .Net compilation -> Debug and Enable Prefetch is set to true.
And I still get the same error message. Anyone found anything in addition to this?
I have encountered similar problems many times while training new employees in our very complicated devenv, so here is our internal step by step instruction:
Don't panic
Make sure you attached the debugger to the correct process - you debug the plugin by launching VMS which is external app that has separate config file where the plugin path is stored, so when you change just your configuration Debug/Release it doesn't work.
Make sure you have symbols generated for the assembly Project properties->Build->Advanced->Output section
Make sure the build path hasn't changed. You may have accidentally changed the path and you may only think that the assembly you are trying to debug is the correct one.
Investigating the information you provided this is only help I can think of. My guess is the files you publish are not the files you're debugging locally.
RESOLVED (embarrassed)
A few day's ago, I downloaded the front-end code for the website from the VPN (GIT). I forgot to update the code-behind reference in the App.js file in the front end root. This, of course, referred to the API on the cloud, and not my local API.
This took me way to long to find out. But, at the same time, it's not a solution I've seen so far on the web.
Thanks for all your help.

How can I debug "Object reference not set to an instance of an object" in VS2013?

I have a c# Azure project that is just a web api, and wanted to remove some of the non-API default components (welcome page, help, etc). After doing so, when launching the application, I get an error message "Object reference not set to an instance of an object." I've seen this before when doing things in Azure, and somehow got around them each time. My question really is: how can I debug this error on my own? This error description is woefully lacking in detail (there's no call stack or anything, as if the app hasn't yet launched, and the dialog is modal so I can't click on anything within VS)
Extra notes:
it's an ASP .NET project.
it works once I publish to Azure.
after copying the project entirely and rebuilding, it seemed to work. then when mucking with NuGet dependencies, we're back to it not working (i've tried deleting my packages folder and having NuGet recreate - no luck; no idea if related to NuGet at all)
I re-copied the project, so just 'MySolutionFolder' -> 'MySolutionFolder - Copy', reopened with same version of VS, runs fine. This is an amazingly sloppy solution obviously, so looking for something better.
As described in a comment, the issue presumably dealt with access rights to various files, most likely NuGet related but possibly Azure as well, which explains why copying to a new solution directory 'fixed' the issue. I would love to see better error info, such as "Error: Visual Studio couldn't write to 'packages.config'", so I know actually where to fix this sort of issue. As it stands now, it's like a compilation error that says "Syntax error in code. Somewhere. Good luck finding it".
Unfortunately, I never did discover a way to debug issues of this sort in a more general way. I eventually worked around the problem, and then saw it pop up again; following advice someone else tried on another forum, I deleted my packages folder, and had NuGet recreate it, which for whatever reason corrected the issue.
Another time, a solution from this question worked (remove and re-add all roles); sometimes this seemed to require an Azure SDK reinstall and computer restart as well.
EDIT
Finally, the best solution I could find was here: delete SUO files and restart VS.
Hopefully this solution will help someone with a similar problem in the future!
tick Debug > Exceptions > Common Language Runtime Exceptions > System > NullReferenceException and run your app
You can enable Intellitrace and remote debug your azure services:
http://blogs.msdn.com/b/webdev/archive/2013/11/05/remote-debugging-a-window-azure-web-site-with-visual-studio-2013.aspx
I've seen similar symptoms when something goes wrong very early in the asp.net app start-up cycle (before the debugger has attached).
One workaround I have used before:
Make sure you are debugging with a local IIS instance and not IIS Express (right click project properties -> Web -> Servers dropdown -> Local IIS
Hit F5 and get your error dialog. (Just to make sure the IIS process has started). Close the error dialog.
Debug -> Attach to Process -> attach to w3wp.exe (iis process). If it's not there make sure 'show processes from all users/sessions' are both checked.
Force a restart of your app by changing the web.config file.
The restart will now occur with the debugger attached to the process from the very start. If that doesn't give any more useful info, then look at turning off 'Just My Code' debugging exception/breakpoint handling and repeating.
For Visual Studio 2019, click on menu "Debug > Windows > Exception Settings".
Under Common Language Runtime Exceptions, tick on System.NullReferenceException. Debugger will break at the point where this exception is caught.
You can setup a local Azure emulator, this is how I've always debugged my cloud apps.
http://msdn.microsoft.com/en-us/library/windowsazure/hh403990.aspx
And maybe do some reading!
http://msdn.microsoft.com/en-us/library/windowsazure/ff683670.aspx
http://msdn.microsoft.com/en-us/library/windowsazure/hh694035.aspx
Inside global.asax:
protected void Application_Error(object sender, EventArgs e)
{
var error = Server.GetLastError();
string message = error.Message;
string callStack = error.StackTrace();
//Write message and callStack to file
...
}
I don't think debugging will help in this case.
However, unloading/reloading your Azure project by right-clicking on it might fix. I'd tried a LOT of things before discovering this one.
As mentioned here.
I also had the "Object reference not set" issue starting Compute Emulator. I found running VS as administrator resolved this.
Changing project target to 4.6.1. seems to have worked for me.
You can debug through logs. Like you can check through diagnostic logs. Enable them through code. There are some configuration for it. I also faced this type of issue and that was very difficult for me to trace. So i enabled the diagnostic logs and write on logs on my custom check point.

section registered as allowDefinition='MachineToApplication' beyond application level

I am getting this error when I create a new folder, and upload files to it. I have an existing site that's built, but I don't want to add this to the site, but rather have it be an application all by itself. Any ideas?
This is indeed the first scenario to check. However, the most frustrating scenario in which this error occurs is after a build/publish under a different build configuration (i.e. build under Release, and then trying to build under Debug and getting this error). You should perform Clean operation on the Release mode.
See this answer which points to further details: Error: allowDefinition='MachineToApplication' beyond application level
I just had this problem not too long ago. Go into IIS, select the folder you created and go to properties. You will see "application name" greyed out, click the "create" button and save it. You will be able to run your separate application in it.
I just solved such errors after hours of trying, I had the same scenario resolved by simply deleting any back up files your solution may have created moving your application from one version of visual studio to the other and the problem is resolved
I faced this issue many times. Different solutions worked in different occasions. Following are the solutions.
Create an IIS application for your web site.
Clean the solution and rebuilt again.
Delete the obj folder and rebuilt again.
Open IIS click right click on the folder and Click "Convert to Application"
well i've just resolved this error.
just go to your project/website folder (not the published one). search web.config in the whole folder if it found more than once, you know which to delete. otherwise if only one web.config is found. make sure its has the rights to be Read. and the final problem if everything is fine, then make a new project in visual studio and remove all the components then add existing project by right clicking it, build,debug. Voila!!!
I had this problem when I moved my application from Window XP to Windows 7. The error is primarily because you did not convert your folder into Application.
The mistake that I was making was, when I selected the folder in IIS and right clicked, I choose "Add Application". This should be "Convert to Application". The resolved my problem.
You want to remove the application from your folder then do the process again and select "Convert to Application".
The project folder you are accessing might be the incorrect one Which result in finding two webconfig file for a project. So try to open the correct website.
For what it's worth, while in development, I got this same error when using "Open Website" on a project that I created using "New Project". If I instead open with "Open Project", the error goes away.
I just faced this today...Here is my fix and understanding of it.
Right click on your webproject and 'unload' it.
Edit your projects .csproj file (I assume .vs.proj in vb)
Look for 'true'
Change it to false.
Save your .csproj
Right Click on the .csproj and reload it.
Hopefully fixes your problem.
It's my understanding that the error you are getting is 'real', in my case
in my web.config was causing the error, because this should actually be set on our server, not by the application.
For some reason, reading Phil Haacks post help me to figure this out...I hope this helps others, I was unable to find a solution that met our needs while looking.
If you are getting this error in Visual Studio, Scott Michell has explained it very well.
Basically you are opening the parent folder of the site. In this case web.conf is in subfolder which does not allow certain tags and hence this error. To resolve, simply reopen the site and select the root folder. The error should disappear.
If the error is IIS related, then creating Application for the folder might help.
Open IIS
Select the Application Pool
3.Select pool where application hosted
4.Click on "Advanced Settings"
5.Change the "Managed Pipe Line Mode" to "Integrated"
If your web application is running in the SharePoint hive, remember to copy your application to the correct hive (14 or 15) and server (FE or App) and then create the virtual directory in the SharePoint 80 "_layouts" subfolder.

Categories

Resources