Intellitrace and Windows Services - c#

I'm trying to run IntelliTrace on a Windows Service, but encountering some issues.
I've (generally) tried the steps that are detailed here: http://blogs.msdn.com/b/msaffer/archive/2011/02/23/using-intellitrace-with-services.aspx.
I've tried VS 2013 Update 3 IntelliTrace download (from Microsoft) and also the new collector thats included with VS 2015 Enterprise RC. Both respond the same.
So:
Test service, registered, running as an administrator (so it's not access rights).
An Environment key has been created with the following values:
COR_ENABLE_PROFILING=1
VSLOGGERCPLAN=C:\Intellitrace14\collection_plan.myplan.trace.xml
COR_PROFILER={AAAAAA70-DFED-4CB4-A1D6-920F51E9674A}
(This is the CLSID that is registered for 2015 RC it seems)
When I start the service, it fires up but in the Event Log I get:
The profiler has requested that the CLR instance not load the profiler into this process.
I've tried with both a 32-bit and 64-bit compiled service (and the relevant IntelliTrace being registered).
I know that Windows services aren't realy a supported target for IntelliTrace, but it did used to work with 2010 etc -- has something really changed for the current versions or am I missing something?

Here is a blog post that explains how to collect data from a windows service in production using IntelliTrace. http://bit.ly/1bTfcIO
If you have any issues following this guide you can also contact me directly at angelos.petropoulos#microsoft.com
On a related note, here is also the announcement that IntelliTrace in Visual Studio 2015 Enterprise now also supports attaching to a running process. http://bit.ly/1bT1Psn This means you can also attach to a running windows service without restarting it.

This post is a bit old and you may have figured it out already... but I had the same issue and, after much searching, a bit of screaming and a lot of trial and error, I finally hit on the problem. The environment setting is very sensitive to extra spaces. Once I cleaned out spaces around or next to the equal signs and from the end of each line, IntelliTrace worked for me.

Related

Is There Such A Thinig As a C# Application Link Map Or Something Equivalent?

Is is there a C# build construct available that would allow me to create a link map containing symbols and offsets? I need to debug an application that is throwing an exception when running scheduled out of Task Scheduler.
Here are some details of what is going on: I have developed a C# application on Windows 10 Workstation (non-server). I am trying to run this application on Windows Server 2012 R2, which, like the Windows 10 system, has .net framework 4.5.1 installed.
The application runs with no known errors on the development workstation, whether it is run installed or out of Visual Studio 2012.
However, the application will not run at its scheduled time out of Windows Task Scheduler. This is the error 0xE0434352 -- I have been reading SuperUser and stackOverflow posts about this error -- and the Windows application event log shows an exception has occurred.
However, the offsets in the application event log are not a lot of help without having a map of the executable.
Is creating a link map or equivalent possible?
Here is a link to one description of a linker map for gcc.
in .Net the assemblies are self-describing. A debug database file is useful, but not necessary to describe the objects and how the code is structured. So I would not think a link map are relevant for .net assemblies.
You might want to take a look at dnSpy, this is a combined de-compiler, debugger and assembly editor. It is often useful when trying to debug errors. It is however limited to managed code, so it will probably be less useful if the error is in native code.

App is not starting after being published

Here is my problem:
I've created a little app to communicate with a server, nothing much particular. I'd like to publish it so I can give the app to my friends but after being published, I click the setup, it asks me to install, and after a few seconds, closes and nothing happens.
I've tried to "publish" the app with a Setup project, it installs and when I try to open the app, nothing happens.
I looked for solutions but nothing worked for me. Do you have any ideas?
The programm is under Visual Studio 2019, .NET 4.7.2
This could be related to different reasons, like lack of runtime ( .NET framework runtime ) on target machines or application behavior as well ( you did not tell much about it).
You could use some logging framework like NLogger or Log4Net to save in a log file at least critical errors and warnings so that you could see on target machine directly what the issues are.
in general if you properly used a setup project that should make sure your installer checks for dependencies like .NET runtime and also creates a desktop shortcut,
if you are publishing via ClickOnce you can easily specify in there to create a desktop icon and to include or download pre-requisites during installation phase.
Are you sure the issue is not related to exception handling and some failure happens when application started and tried to communicate with your server and for whatever network setting or reason fails to do so and then silently crashes?
If you try to connect to the server at the initialization of your program (form_load, etc.), it can happen when the connecting to the server fails. The whole application waits to reach a timeout, which may be 30 seconds long. Please check this scenario. See if the server is available and connectable.

Open Office automation fails when executed from Web Service

I'm using this guide as a basis for what I'm doing:
http://www.codeproject.com/KB/files/generatepdf.aspx?fid=1517061&select=2903150&fr=1#xx2903150xx
I am using the Open Office CLI bridge to try to create an ASP Generic Handler that will download a file from an MS SQL database, convert it to a PDF, and send it back to the browser or app that requested it.
Here's what I've tried:
The Service shown in that article (including adding the OO.org 3 fixes).
Moving the relevant code directly into the Web Service and Switched IIS to run the 32bit .Net runtime (required for OO.org).
Creating a command line tool that performs the conversion and then spawning a process that runs the tool and waits for the Exit code (0 = success, 100 = failure a, 200 = failure b, so on and so forth)
So far all of these work when debugging the code using the development ASP server that Visual Studio provides. What doesn't work is deploying it to my development server and trying to run it there. I can get processes to run no problem, including OpenOffice's soffice.exe and soffice.bin, but under none of those circumstances does the conversion actually occur. I've tried giving the IIS service the ability to interact with the shell and trying to run the process under my own credentials (works under VS's ASP.net server but not on my dev server) but neither was fruitful.
This has been rather frustrating to be so close yet so... far. Any help figuring this one out would be appreciated. My guess is there's some IIS/ASP.net configuration option that I'm missing. My development and production environments use VS2008 and IIS6 under Windows XP 64bit.
Thanks,
Max
Have you actually installed OpenOffice on your production machine. I know that sounds big, but I have had a similar issue when dealing with MS Office. Regardless of whether I copied the appropriate files across they weren't registered.
Hence installing MS Office solved the issue. However I am sure if you register the appropriate files it would work as well. Maybe as a quick test deploy it on a machine without Open Office installed and see if it works, then install Open Office and see if

windows service written in c# .NET 4 vs2010 will not install on Server 2008 R2 Enterprise

I've written many versions of windows services and installed them on a 64-Bit system with 32 GB running Server 2008 R2 Enterprise.
I create the services using this recipe:
http://msdn.microsoft.com/en-us/zt39148a.aspx
"Walkthrough: Creating a Windows Service Application in the Component Designer"
I create the .msi and corresponding setup.exe on my Win 7 laptop (c#, vs2010 SP1, .NET 4).
NORMAL BEHAVIOUR
after testing a Windows service on my laptop, I copy the .msi and setup.exe to a folder on the win2008 R2 Enterprise server (using copy and paste via remote desktop); I use the server's Control Panel to uninstall, right click the .msi and choose Install, then walk through the Setup Wizard. No problem. Works most of the time.
ABNORMAL BEHAVIOUR
The install runs for perhaps 15 minutes or longer; it never finishes; eventually a dialog states
"(?) Installer is no longer responding."
with options to [Retry] or [Cancel].
At this point, the progress bar is a short as it could possibly be and at the far left, beneath the "P" of "Please wait...".
Clicking Retry does not help. It's been over 30 minutes and counting since I clicked Retry and the progress bar has not advanced even a pixel.
MORE INFORMATION
(a) the service installs without any problem on another server, a Win 2008 R2 web edition.
(b) as mentioned above, the Windows service both installs and works properly on my Win 7 development and testing environment.
HISTORY / SPECULATION
a couple of weeks ago, I was unable to install a service from the win 2008 R2 Enterprise server. I could not find it in Control Panel/Uninstall even though the .msi claimed it to be installed and the service also continued to appear in the services.msc console. Even disabling the service did not help. For that reason, I cloned the code, changed the service name slightly, and successfully installed that service which has been running for while without issues.
Today, a similar event happened, the only difference being that I can see that service in Control Panel Uninstall. Because it would not uninstall, I tried my same cloning trick but this time it failed.
Next step: using the above walkthrough, I created a do nothing Windows service and made it useful by importing my client classes into it from the original c# project file.
The re-built from the ground up Windows service works as designed on my laptop but refuses to install on the R2 Enterprise server.
Any ideas?
Please and thank you.
P.S.: i posted this at so because imho it's more likely something that a developer is likely to encounter prior to handing off her/his code to a sysadmin.
BTW, I could not find anything related at so; ditto via Google.
in this particular case, it is some very weird server rights condition
MORE INFORMATION
although my server account is not Administrator, I'm a member of both local and domain Administrators for this 2008 R2 box.
I had tried many ideas, including creating the example in the walkthrough and trying it. No luck.
The boxe's Administrator was able to install my service using installutil.exe so I tried installutil.exe but it would only work for me using the Administrator's credentials.
For that reason, I suspected it might be a rights issue, so I tried with my credentials installing the walkthrough example on the H:\ drive. Success. Next, I tried installing the troublesome Windows service on C: in a different location. Again, success.
What is strangest about this issue is that many times I had no problem then suddenly a problem arose to block my development efforts.
A sign that a Windows service will install is when a dialog asking permission to continue appears almost immediately after starting the install. Another clue that success is possible is being able to successfully uninstall any previous version via Control Panel.
I appreciate everyone's efforts to help me with this. Thank you.
I've had similar experiences with my own MSI's (not just for services), as well as third party MSI's on Win2k3 and Win2k8. I never (ever) got to the bottom of it without a 'fresh' re-install of the operating system.
Just like you, I too speculate that there's something lost in (a combination or all of) the internals of the OS (registry, file-system, system restore).
I know this is not what you want to hear but (if at all possible) a clean install of the OS might do the trick for you.

C# WinForms App won't run on Win7 after Building

I have a program that I built that reads and writes files. I built it in Release mode, then tried to run the exe on Win7. At first, with troubleshooting on, Windows simply told me the application closed and it was looking for a solution. After a few seconds, the dialog would disappear and show nothing more.
So with some significant effort I got the debugger attached to the process, but it was only showing me disassembly, which tells me that the error taking place wasn't in my application code, but in the framework somewhere.
The strange thing is that when I let the debugger attach, then press "stop" in VS, and exit the debugger, the program actually runs at that point!
So now I'm stumped. I have an application that builds, that seems to be having a permission error when I run it, but if I let the debugger attach then close it, it runs, and there's no Exception to really look at.
How I troubleshoot this issue?
Edit: Responding to Merlyn:
It's a custom app written from scratch in c#. The only dependency it has outside of core .NET namespaces is the Ionic.Zip DLL.
Visual Studio 2008 (Writing in C# 3.5)
Windows 7 - Home Premium, v6.1 build 7600
CPU - x64 quad core
CPU are you compiling under: Any CPU
I haven't tried it on another machine or a different version of VS.
Edit: I was able to try the compiled version on another win7 computer, and it worked without issue, so it looks like a security (?) issue on my computer only.
Try it in the debugger with Just My Code disabled and Native Code enabled, then check the call stack.
Also, what happens if you run it directly in Visual Studio?
Uncheck Enable Visual Studio Hosting Process in Project Properties and see whether it still works in VS.
I'd suggest sending the issue to Microsoft support. Especially with the data given here, you will have an easy time convincing them it's their problem. You might need an MSDN subscription for that.

Categories