Debugging activeX dll via classic ASP - dll

I finally got my localhost to display the site locally. Everything seems to be working on that end. My next step is to actually be able to step into the code from the VB6 IDE when the web site uses a function from the ActiveX.dll
UPDATE:
I updated the code and removed the issue I was having compiling the code.
Now when I try to debug the site won't open. It just hangs. I'm wondering are there any tutorials that I can read so figure out how to properly get this application setup for debugging?
UPDATE #2
Just to clarify, I got the web site (which references the ActiveX .dlls) locally on IIS 7.5. My hope is that when I open the site (on localhost) I can step through the .dll code at the same time.
That is really what I'm asking.

It's actually quite easy. First of all, do an iisreset. Then load up Visual Basic with your ActiveX DLL. Place your breakpoint, then Run your project.
Then hit your page containing a call to the ActiveX DLL and it should stop on a breakpoint you just set.

Related

How To Debug Web API Project From MVC Project In Another Solution

I have a MVC project solution and a separate API project solution (because it is used by different other solutions).
During debugging is it possible to hit the API solution code on debugging?
Both solutions are obviously running, giving correct data and results, the issue is that I am unable to hit the API project code during debugging - the debugger skips over the API and hits only the main solution.
EDIT
I realised that the API is a separate package and is referenced in the main solution as an assembly so I am not sure if it is possible to hit the breakpoint there at all? It's not used via Ajax.
yeah it is possible.
Assuming you use Visual Studio, start a second instance and attach it to the running process of the API. Put a breakpoint in your API and do whatever you need on the MVC side, to hit the correct endpoint in the API. Execution will stop and you can now debug in the second project as well.
This all depends how you run the API, you can even run the API from Visual Studio, using IIS Express in which case your URL will look something like http:\\localhost\api\sbla\bla:50310 for example.
Attaching works very well when the API is run outside of Visual Studio in proper IIS.
Make sure you tick the box which says "Show all processes" and look for a process called w3wp I think, this is all from memory.
You can't debug the API from the MVC project as they are both running under different processes
------ added after extra info ----
if the API stuff is inside a dll then make sure that dll is built in debug mode and then you can step into it. put a break point inside your MVC code right before you have a call which goes into the dll, then step into it and continue from there with normal debugging
Yes, it is possible.
Just open both your solutions in visual studio. Build the API project and add its dll to MVC project. Put break point on your API and run the API project. Now run your MVC project. Hit the API from your MVC project and break point will surely hit in API.

WCF, DLLIMPORT strange issues

I have a very strange issue that i cannot figure out.
First i have a WCF service 4.0 done in VS2010.
the service have couple methods that return string array, datatable and such.
some of them use function from C++ dll throught [dllimport]
i made a test console to test everything. when i run the WCF from visual studio and use the generated path it works wonderfully.
now here is where it become strange. if i open my local IIS create a new application and point to my VS source code the WCF i can see it perfectly.
now using the http path from IIS local instead i refresh the methods all seems correct. But when i run my test app i can call any unction without any problem EXCEPT anyone using DLLIMPORT functions. they ALL crash and cannot trace even by tracing CES exceptions.
Doing line by line logging show that the exception is really on the call of those functions
the DLL in question is the same and the path is hardcoded for my computer since still in test phase and the folder is c:\DLL\mylib.DLL so nothing to do with shadow copy IIS/visual studio do when you actually run. also DLL reference by name withotu path even if it's in sys32 doesnt work.
Any clue ?
also. 32bit, changing app pool level right access on folder, full admin on machine already too. all tried but unsuccessful.
Edit: adding to all that since i haven't made this clear, it's not my first WCF real setup. i've already made alot of services before and deployed them myself (probably somewhere around 50-60 services). I am asking because i have never seen this issue before and i tried all tricks i knew and could find on the internet and resource people i know.
We have decided to incorporate the whole service in the WPF project locally since it work as long as IIS is not hosting. but this is really not a good thing as this data and work should NOT be done on client side but instead on server side. Right now it's fine since the software that need to use this is not released to public yet so it isn't critical.
Next option will be net TCP/IP windows service hosted on the web server if i don't find anything else.
We decided to go trough the trouble of having to hard code the logic in the main software and get away from web services for this issue. we will have to deal with updating, installing unregister and re register unmanaged DLL by hand somehow but at least it works.
we have added over 5 web services since that happen and no problem with them but again none of them use DLL imports.

Visual Studio .vshost causing exception

I'm making a chat program in Visual Basic. It's supposed to be for LAN, and it's called LANChat.
It starts a listener on port 65535 (just for now) and continues to listen on that port. However, if you tried to open two instances of it at once, there'd be a runtime error. I've handled that, and it shows a MessageBox and closes the program if it detects that the port is currently being used. However, in Visual Studio, when attempting to test the program, it runs the program as if it's already being run. I looked in task manager and I see "LANChat.vshost" is running at the time. Any ideas? The only idea I have is to comment out the exception handling code while testing.
Under your project properties > Debug you can deselect the 'Enable the Visual Studio hosting process'. This will take the hosting process out of the question, if it works then then hosting process was interfering somehow, if not then the problem lies elsewhere.
It would be better to create your progra as a single Instance program. Than you should avoid the vshost probme.
I've done it for myself and it works fine.
Sorry i cannot provide code, I am at home :(

How do I start a console application in one project from a web form in another project?

I have a website created in VS 2010 with .NET 4.0. There are multiple projects in the solution. In one of the projects I have a form that gives a user the option to run a console application that is in another project of the solution. (called update.exe)
I have tried just using
process.start(filepath + "update.exe")
but it doesn't seem to run.
It finds the file but then finishes immediately. I tried adding Console.readKey() to the console application so it would stay open after being called, but it was to no avail.
On top of this, I know that the console app isn't running as I have logs set up throughout the console's code and it never even seems to kick off.
Should I be calling the console app differently? (note: I am writing in VB.net)
Thanks!
Purely speculative here.. but my guess is that when the page finishes processing the process is terminated. Try having the page wait for the process to close.
My 'work-around' for a similar requirement is this:
Use the ASP page to create a CMD or BAT file on the server.
Create/write a service that 'watches' for the CMD/BAT file - and when it finds one, it runs it. The service can be written to start a process as a user.

Problems with debugging in Silverlight 4 using Out of Browser and WCF RIA Services

With Visual stuido 2010, it's simple to set up SL4 to debug with an out-of-browser installed app. I followed the instructions from here and everything seems to set up fine. Debugging from the browser runs the program just fine, but running from the OOB program gives a different result. After starting, the screen will go blank and then hang forever. I have some concerns that it might be because of some of the technologies that we're using.
Firstly, there's a popup that happens because we're using WCF RIA Services (formerly .NET RIA Services).
"RIA Services will fail unless the silverlight project is hosted and launched from the same web project that contains the RIA Services."
This seems to just be a warning, but I have a suspicion that this warning might be telling me that RIA Services needs to have the .web project as its startup project.
We're also using prism and the error has an odor of a Prism error too. (something loading and then not ever appearing)
Has anyone else had any issues with OOB debugging in SL4? Is anyone else OOB debugging in SL4?
Sorry it's so vague. It's a complicated mess. The only message I see is the italicized popup warning. Then the window (which was previously showing the background of our application) just goes blank
There is currently a known issue with debugging an Out of Browser Silverlight 4 application when using F5 to launch the application from within VS 2010. The question I have is whether or not the application launches without debugging (-F5 or running it from the shortcut)? In the case of using F5, a dialog typically appears with the following error dialog “Unable to start debugging. A fatal error occured. For more details, please see the Microsoft Help and Support web site. HRESULT=0x80070018” and then the application appears to hang. In this case detaching allows the process to continue and then reattaching should allow you to debug the process.
If this is completely blocking or you’re trying to debug code running at startup (like the page startup event), one possible way to get around this would be to put in a call to System.Diagnostics.Debugger.Break, start the program and then attach when dialog pops.
This can be caused by the OOBA install being older than the version you are trying to debug. Remember, Silverlight OOBAs do not automatically update themselves to the latest version of the XAP file that may be available on the server. You have to update them yourself. If you get this error and you have included the auto-update logic in your app, just bounce out of VS, run the app so it auto-updates, then go back in and debug.
Alternately, you can uninstall the app and re-install it. That will ensure you are debugging against the latest VS build.
I ran into this same issue with VS 2008 and Silverlight 3. If I got it, I just jumped out and updated the app then re-ran it in VS and had full debugging.