Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 831379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:11:41+00:00 2026-05-15T04:11:41+00:00

I have deployed successfully a C# windows service on a windows 7 machine. Now,

  • 0

I have deployed successfully a C# windows service on a windows 7 machine.

Now, when I try to create a file using this code :

  FileStream os = new FileStream(String.Format(folderName, fileName), FileMode.Create);

I get Access to filepath is denied.

In the service Installer I set the following parameters to :

   this.serviceProcessInstaller1.Account = 
       System.ServiceProcess.ServiceAccount.LocalSystem;
   this.serviceProcessInstaller1.Password = "Pass";
   this.serviceProcessInstaller1.Username = "Administrator"

I added all the possible accounts with Full permissions to the folder where I want to create the file but nothing helped.

Any suggestions would be highly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:11:41+00:00Added an answer on May 15, 2026 at 4:11 am

    You’re using String.Format() in the wrong way. Look at msdn http://msdn.microsoft.com/en-us/library/fht0f5be.aspx.

    You probably want something like

    FileStream os = new FileStream(folderName  +@"\" + fileName, FileMode.Create);
    

    or

    FileStream os = new FileStream(String.Format(@"{0}\{1}", folderName fileName), FileMode.Create);
    

    or

    FileStream os = new FileStream(Path.Combine(folderName fileName), FileMode.Create);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just deployed a new MVC3 app to my hosting provider for the
I'm very new to infopath & sharepoint. I have created a form in infopath
I have deployed my pylons app on the server~ I use nginx end flup,
After I have re-deployed my app to Heroku, it displays the old public/index.html. What
I'm trying to implement a function which would load a server-stored CSV file, and
I have an ASP.NET MVC 3 app. It is working fine in both IE8
I'm deploying an MVC3 application to a new server. The application runs fine on
So this error is coming from an attempt to solve another issue I am
I've just installed Glassfish Web Profile ( Open source edition ) on my VPS.
Summary: Running mvn war:war fails with errors including: The following artifacts could not be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.