Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running VS as a service - SOLVED!
Message
From
29/04/2019 16:45:13
 
 
To
29/04/2019 14:07:44
General information
Forum:
Visual Studio
Category:
Other
Miscellaneous
Thread ID:
01668300
Message ID:
01668302
Views:
47
>>This is a tip that I hope will avoid some grief for someone.
>>I created a Windows service fires off a VS 2013 C# app every 20 minutes.
>>The app looks for events and fires off emails and FTP's.
>>When I ran the app by itself it worked, but when the service fired it it failed on some functions.
>>It worked fine for most functions, but when it tried to create a pdf (or any other type) from a report it failed.
>>I've been trying to fix this for a couple of months and, using a clue that I found on the web last week I got it running OK today.
>>Here's the solution:
>>The service is either a. incompatible with the report viewer control required by VS 2013, or it just couldn't find it.
>>
>>VS2017, on the on the other hand, has a built-in report viewer and doesn't need an external report viewer.
>>That has other positive benefits
>>I rebuilt the app with VS 2017 (you'll have to pull the report viewer in with NUGET) and the problem disappeared.
>
>You can debug services using Visual Studio. Add some startup code which introduces a 60-second timer (Windows Sleep() function works, and I'm sure there's a C# equivalent), and then after the service launches go to Visual Studio and attach to the process. Set a breakpoint on the line after the timer and you'll be able single-step through your code like a normal debugging session.
>
>You can set breakpoints and find out what's failing where like you would doing normal debugging.

Rick

Good tip
In this case, however, I knew how and why it was failing, but not how to fix it till I saw that clue on the web.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Reply
Map
View

Click here to load this message in the networking platform