Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Privileges
Message
From
28/03/2019 14:20:04
 
 
To
28/03/2019 13:50:24
General information
Forum:
Visual Studio
Category:
Administration & Security
Title:
Miscellaneous
Thread ID:
01667640
Message ID:
01667641
Views:
62
This message has been marked as the solution to the initial question of the thread.
>I have a C# program that creates a .csv file and emails it.
>Recently the client asked to have it run automatically, so I added to function to an .exe that is fired periodically by a custom Windows Service.
>If I log in to the client's machine and click the .exe all goes well.
>However, when the service fires the .exe, we get the following error:
>
>Prowler Error- 03/28/19
> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
> at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
> at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
> at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
> at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
> at System.IO.StreamWriter..ctor(String path)
> at AnalysisClassess.AnalysisMethods.SendPickupData() in q:\ssprowlersource\AnalysisClasses\AnalysisMethods.cs:line 188
> at AnalysisClassess.AnalysisMethods.ExecuteReview(DateTime lastreviewdatetime) in q:\ssprowlersource\AnalysisClasses\AnalysisMethods.cs:line 105
> at ssprowler.ProwlerMethods.StartApp() in q:\ssprowlersource\ProwlerMethods.cs:line 56
>
>It seems to indicate that there is some kind of privilege issue with the file creation.
>Any ideas?

Yes, you would need to scale that security up to the Windows Service credentials. When it runs, it runs under a different account that yours when you are directly on the console.

In the Windows Service Log On panel, you may select This account and add the required credentials.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform