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

  • Home
  • SEARCH
  • 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 8525105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:52:43+00:00 2026-06-11T07:52:43+00:00

I face weird problem with IOException on different servers. Here is my story: I

  • 0

I face weird problem with IOException on different servers. Here is my story:

I have win server (C#) that monitors folder for file changes. Also, a FTP server (WinSSHD) is pointed on same folder. When someone uploads a file WinService checks is write complete or not. If file is uploaded WinService renames it via File.Move method.

Is write complete check is made by File.Open method. Like this:

public static bool IsWriteComplete(string filePath)
{
    bool isWriteComplete;
    FileStream stream = null;
    try
    {
        stream = File.Open(filePath, FileMode.Open, FileAccess.Write, FileShare.ReadWrite|FileShare.Delete);
        isWriteComplete = true;
    }
    catch (IOException)
    {
        isWriteComplete = false;
    }
    catch (Exception ex)
    {
        isWriteComplete = false;
    }
    finally
    {
        if (stream != null) { stream.Close(); }
    }
    return isWriteComplete;
}

For some reason on one server it works perfectly (Win2003SP2) and on another one (Win2003SP1) is not working at all. The IsWriteComplete method says True, WinServer tries to move file and dies by IOException later. I haven’t found any references regarding such issue.

To fix the issue I replaced File.Open by File.Move.
Before:

stream = File.Open(filePath, FileMode.Open, FileAccess.Write, FileShare.ReadWrite|FileShare.Delete);

After:

File.Move(filePath, filePath);

And now it works on second server (Win2003SP1) and doesn’t work on first one (Win2003SP2).

Does anybody know why it works as such?

  • 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-06-11T07:52:45+00:00Added an answer on June 11, 2026 at 7:52 am

    Found the root cause of the behavior.
    There was different FTP service installed: Techia. For some reason Tectia doesn’t set write lock on uploading files. That’s why File.Open(filePath, FileAccess.Write) doesn’t throw IOException.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ohk i am facing this very weird problem . i have a cloud server
I face with a strange problem yesterday. I have server running Debian with installed
I currently face the following problem: I have written a Java program that parses
I face this problem. I have a filter that sets the character encoding of
I have this weird problem as to how to name objects of a class.
At face value, it would seem that object initializers present a problem for .net
I face some problem when I use submit. Here is the code using some
I face the following strange problem while using JFileChooser package sandbox; import java.io.File; import
I face some problem on my script that I use PHP and jquery to
I've isolated some weird behavior that seems to occur when you have a block

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.