I'm using VS 2012 express to build a "multi-tenanted" website with MVC4. The website itself is all going swimmingly.
In order to ensure separation of concerns, I have a plugin type of architecture, whereby I have other projects in my solution, one for each "tenant" so to speak. This means I can have a core website and just plug in a tenant plugin when required.
This appears to work fine. How it works is that on a build, various files get xcopied into the host site. It's a slight nuisance that a change to a .cshtml for example, I have to build to get the latest, but no matter.
I did also have problems trying to connect the database for the host with the database for the tenant through linq (so that I could have user specific data from the tenant, based on the logged in user on the host), but that is working now.
However, I am now hitting a bit of a road block and it is drastically slowing me down.
Because the files are xcopied, they don't appear to come under the debugger, so putting in a breakpoint on a tenant controller has absolutely no effect.
Does anyone know (or have any ideas) on how to debug the tenant DLL? All ideas would be appreciated. Thank you.
I've done it again... been puzzling over the problem for quite a while and then worked out how to do it.
In the "tenant" project properties, click "Web". CHECK "Override application root URL" and use the same URL as the host website.
Basically, the host is using IIS Express, on http://localhost:51402 the "tenant", even though it is not the main project was using http://localhost:49931 so was not getting connected as the tenant project was not technically being run.
Making it use the same URL by overriding application root URL allowed it to connect.
EDIT
Now, I am not so sure that the above actually solved the problem, partially solved it or was just timing that made it look like it solved it.
Reason being, I had it happen again where it didn't debug. However, hovering over the breakpoint, it said the source was different to what is currently running. This confused me a little.
It seems that when a build happens by clicking the green go button, the post build events that are in the properties are not executed. In the post build, I have the xcopy to copy the files over to the host app.
So, that means I have to build by hand, then run the green button (and build again).
Related
I'm sure this has been asked and answered, and I apologize for that, but I'm not really even sure what I'm looking for or need to do. I'm an electrical engineer that can play with programming, but when it comes to servers and remote stuff, I get really lost.
Anyway, here's the stick. I'll try to be specific.
I'm not sure this part matters, but I'll try to explain for clarity's sake. We are developing a machine. This machine is run by an IPC. The IPC is basically a PLC that has embedded Windows 7, and the IPC itself is programmed with Structured Text which is written in VS2013 (doesn't work on newer versions). In order to 'activate' the programming and parameters that we set in VS2013, this computer must be connected to the machine with an ethernet cable. I can also remote in to manually control the machine from this computer.
For an operator to control the machine in general, a CS major wrote a program that we call the HMI, or Human Machine Interface. I access and update the code for this, which is written in C#, through VS2017. The project is set up as a solution, and in order to 'activate' this programming after making changes, I just build the solution and copy the dll file over to the machine, through the remote interface. On that machine, we just click an executable that starts the IPC and then I'm guessing the IPC has been linked to the HMI program, because that opens shortly after that.
Ok, now, I'm trying to implement a new feature into this HMI and I'm running into some unknown error. In order to correct this with any program I've written in the past, I would normally set a breakpoint and/or run the debugger and go through step by step until it breaks. However, since this program has to run in tandem with the IPC, which it passes values to and receives output from, it's more complicated than that.
The CS person I mentioned no longer works here, but his note says that the debugger can be run as long as I'm connected with the ethernet cord I mentioned. When I try, though, I get "A project with an Output type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."
Now, from googling, I've found and tried to set the solution as a startup project, but it didn't seem like anything happened when I selected that, and furthermore, the error persists. I'm guessing that I need to do the latter, which is to 'add an executable project to the solution and set that as the startup project'... but I really don't know what that means, at all.
Do I 'add an existing project' (under File)? If so, would that be the project/solution from VS2013?
Or do I somehow need to add the executable that we click on the machine?
I sound like an idiot, I know, and that's because I am when it comes to this stuff, haha. It may be too complex for anyone to even attempt to answer, or so simple that I'm way overthinking it. I have no idea at this point, and I'm desperate.
That said, I would really appreciate if someone had any idea. Regardless, thank you for your time.
You can debug an executing process by using Visual Studio's Attach to process tool which is in debug menu. This will attach your source code to an executing process as long as the code and process code match.
I am working in VisualStudio 2010 SP1 on an application server system written in C#. (Yes this is a legacy application.) The system is a large multi-threaded server application that provides a large SOAP API along with newer REST APIs for other portions of the system.
For a long time I have noticed that occasionally when starting the system in debug mode both the server and VisualStudio would stall. Neither UI would respond and calls to the server APIs would block. This situation could be recovered from only by halting the server using Task Manager, after which VisualStudio would complain with an error.
Recently this problem became persistent, that is it happens every time. The lock up occurs at various times, that is I have not been able to identify a specific time when the system locks up, it may (often) happen as soon as the server is started, other times it may take a minute or so, but always shortly after startup, both VisualStudio and the server lock up.
If I try to do something in the VisualStudio UI, e.g. pressing the Pause button, I will get the "Microsoft Visual Studio Delay Notification" icon in the notifications section of the Windows task bar.
I have done some investigation on the web and have tried the following unsuccessfully:
Clean rebuild
Removing all build products from the directory structure
Doing a clean checkout in a new directory structure
resetiis
Removing the .suo files
Resetting the VisualStudio settings
I have also tried creating both mini & full dumps of both the application and devenv, but I have not been able to understand them well enough to find any issue.
What would you do to try to identify the issue?
The solution to my issue turned out to be working on the program using VS2015. This is not a wonderful solution since we still build in VS2010, but it at least allowed me to proceed. We are not sure exactly what caused the issue.
I've been trying to solve some UI issues I had on my website.
I realized that my web app was moving textboxex, dropdownlists, etc.. when after I was putting values on them.
They passed from being on the left to be on the right side of the div, weird things like that.
Well, this is the behaviour I saw when I was debugging or running from my VS2010.
Then I deployed the website and loaded into my server.
..And for my surprise, this behaviour was not happening.
Did anyone see this before?
Why is this happening?
What is the difference between debug the website, start it on the browser without debug or publish it?
I would suggest that you try debugging under IIS Express instead of the VS development server. Sometimes there are subtle differences between VS Dev Server and IIS, especially when you are dealing with things like session.
Problem was related to style issues.
Tried with more specific styles, not letting them grow bigger than it should
I have recently changed from web site model to a web application model. One change that i noticed was that in a web site, while i was running the site on my browser locally, i could make changes to the .cs files and just refresh the browser for the changes to take effect.
However in a web application the .cs files seem to have a lock which does not allow me to edit the .cs file without stopping the debugging.
This gets kinda lengthy since i have to stop and run again instead of making changes on the fly.
Is there any debug setting to get around this?
Thanks in advance.
Here is my current Edit and Continue window with the current settings. Do i need to change anything here?:
You can modify the code in a Web Application while the code is paused. You'll need to set a break point above the line of code you wish to change. Execute the code to reach the break point, and then while you are stopped at the break point you can modify the code. The once the modification is done you can resume execution.
There are certain things you cannot change while paused like this, like adding in a new method. If the change cannot be accepted while paused Visual Studio will tell, however, it won't tell you what exactly is doesn't like.
The feature you are looking for is "Edit and Continue" and should be in Debug>Options and Settings>Debugging>Edit and Continue. This doesn't give you the complete flexibility to change anything you want but does allow some basic changes.
I have a solution that consists of a Class Library project and a remote web site.
I start the debugging and the page comes up and if I make changes to the source I can see them happen on the page that's in the debugger ... but I can have a breakpoint on the first line of the Page_Load and it still won't hit. Same things goes for any breakpoint in the Class Library's codebase.
I've debugged other applications off this server successfully before ... but have hit a wall with this one.
What am I doing wrong?
Both projects have are .NET Framework 4.
If the breakpoint isn't marked as a full red circle, either no symbols have been loaded for the type or the code you're debugging is different to what you have in your editor.
If the latter, you can right click the breakpoint and select allow source to be different... checkbox
I decided to try a few more things to get this working so I first did a fresh Open >> Web Site ... so that I had a solution with just the remote web site and tried debugging and that worked. So, decided to try living a little dangerously and then added the Class Library project back and tried Debugging again and it worked for both the .aspx.cs files and the .cs ones from the Class Library!
Don't ask me to explain it ... the only thing I did differently is that the first time around I started with the Class Library, added the remote site and then set the Web site as the Startup project. Should work the same, you'd think ... but I'm not gonna question it
Have you tried to use internet explorer ? if your in an different navigator.. you must attach that navigator processus to the debugger in order to debug.