I want to write every event on the running(in production) application to log just like Visual Studio does when I run the application in the debug mode.
There's all sorts of functionality in the System.Diagnostics namespace. I think you're looking for the EventLogTraceListener.
This can be configured via your config file or in code. Note the remarks section that warns about possibly needing admin rights to create the event log.
Related
when i try to rebuild My Project Setup installer
in the first it try to configure as in This Image
then this message in This Image
Express: 1) Reboot, 2) disable anti-virus, 3) launch as admin and check. Then, if need be: 4) verbose log, 5) event logs. 6) Try on a virtual if you still can't get it working? Or secondary computer? Also 7) google exact error messages and check user comments. 8) Run general Visual Studio update?
Malware?: Run a full check for malware too? It is all over the place these days.
Locks?: A quick search seems to indicate a permission or patching issue of some sort.
You can try to run the tool with elevated rights?
You could have disk corruption - disk errors? Faulty ACL permissions? (possible)
It also just might be that your anti-virus suite has locked some file that MSI is trying to put back in place. You can try to
disable it temporarily to see. Note that the file can have been
quarantined as well (moved somewhere else).
Tip: Maybe check section: "A Deployment Mnemonic" here (down the page, yellow section).
Additionally: Please try the few hints here first. In essence: Reboot, get a verbose log file created, check event logs and try to log in as another user (generally only effective for user profile corruption issues, but can help):
Create verbose MSI log:
msiexec.exe /I "C:\file.msi" /QN /L*V "C:\msilog.log"
Stefan Kruger's site: http://www.installsite.org/pages/en/msifaq/a/1022.htm - you can enable the logging policy for all MSI operations to log all MSI operations. Section: "Globally for all setups on a machine".
Logging interpretation tips here. How to make sense of the MSI log files.
Links:
MSI Logging, comprehensive: Enable installation logs for MSI installer without any command line arguments
Not sure if this is the same error but you can give it a try. Just follow the steps from "How to work around this issue" section of Trouble installing other products after Visual Studio blogpost.
If there are indeed Visual Studio missing folders try to recreate them and see if this helps.
The behavior could just be a self-repair mechanism of the MSI installer of some Visual Studio setup modules triggered by the fact the related Visual Studio installer modules were incorrectly built by MSFT team (the MSI components were simply wrongly defined or sth like that).
I have created a Setup file of my WPF application using Visual Studio setup project.
The setup seems installing ok and I get the installed folder and all the files that are intended to be there.
Now when I run the exe I get following error screen.
Please note when i run the application it runs pretty wel without any issues.
Please note I am using EntityFramework,WPFToolkit and log4net with the application.
And I am installing the application in the rot of C drive to avoid any restriction issue writing the log files.
Can anybody please let me know how I can track what is happening ? I tried 'try catch' in App.xaml.cs OnStartUp and MainWindow constractor returning no exceptions.
Following link has the files mentioned in the error screen :
https://www.dropbox.com/sh/2shp428xcawuk8u/mg5cyXvQ_8
My guess is that your application doesn't have write permission in somewhere.
You just need to find out where it is.
The best solution is to add a listener to Application.DispatcherUnhandledException and see what the real error is. It works even better that log4net.
My website is using the MSCaptcha library for captcha functionality. The implementation requires handlers to be defined in the web.config file, a web/httphandler for older IIS and the development server, and a webServer/handler for IIS7+.
Now, every time I publish my project to the production server (which runs IIS7), I get an internal server error message because http handlers have been defined in the config file. Once removed, the website runs perfectly. However, when I am testing locally I need to have http handlers defined as the dev server doesn't seem to read webServer/handlers.
Obviously one solution is to simply remove the httphandlers temporarily every time I publish my website to the production server, but since I do this pretty often it is a bit cumbersome. Is there any way to specify when the http handlers should and should not be included in the config file?
Use configuration file transforms and build names to accomplish this. Create web.config that has the dev/local setup, then create a transform for release mode that removes your entry and creates the proper IIS7+ one.
Then whenever you deploy release mode it'll be right for your release environment!
This functionality is built into VS, but for non-web apps it won't work without using something like SlowCheetah.
Examples:
http://msdn.microsoft.com/en-us/library/dd465326.aspx
I have created Excel RTD Server, after all implementation completion in debug mode, I am able to run RTD and it is working fine. But when I get the dll in release mode and take it to another system, and register using "regasm.exe" and also provided complete DCOM user access with "everyone" but still using =RTD(), gives me error as #N/A.
I am expecting something I am doing in deployment.
I am stuck here, please help me out.
Thanks
I had similar issue, in my case the office installed on the machine was 64-bit, therefor i had to register the RTD dll using the 64-bit regasm.exe.
Take a look here:
http://social.msdn.microsoft.com/Forums/en/exceldev/thread/7a9e865e-5138-45c0-8f31-ddc148509dbe
good luck.
I had this problem too and it turned out that while in debug mode, VS was able to see my RTDServer, in deploy, windows couldn't because I hadn't explicitly instructed the setup project to do so. To register the rtdsrver.dll as part of a setup project you can do the following:
right click on the setup project: view -> filesystem
in the file system viewer, select the system folder
select your rtdserver.dll and view it's properties
set the Register field to vsdraCOM
Redeploy
Now, excel should be able to see your server assembly in deploy.
I can't seem to write to the event log in .NET. I get the following exception:
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
I don't want to access the Security log. How do I get around this error? Thanks!
You can try to Start Visual Studio with Run As Administrator permission.
You can try to create an event log in your application like Lachlan suggests but realize that this will require administrator privs. Instead I reccomend that you take care of this in your installer / deployment automation layer.
I use WiX so I recommend reading:
How do you create an event log source using WiX
Have you set the source for your eventlog? E.g.:
EventLog.CreateEventSource("My Super App", "Application");
If, for example, you are developing a service application that use EventLog class and need to test somes classes before running the service, which need to be installed. You can add a app.manifest to your project (not service project, maybe a console application), and in 'requestedExecutionLevel' set the level to "requireAdministrator", when you try to run your project from visual studio, it will ask to elevate the permissions that will (if want)i restart the visual studio, then will be can to use EventLog class.
hope this help,
antonio