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 58567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:52:05+00:00 2026-05-10T17:52:05+00:00

I have deployed ASP.NET web site and ASP.NET web service on the same web

  • 0

I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file.

How to implement/share lock that supports single writers and multiple readers? If somebody reads, nobody can write, but all still can read. If somebody writes, nobody can read/write.

  • 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. 2026-05-10T17:52:06+00:00Added an answer on May 10, 2026 at 5:52 pm

    to open file for writing with allowing other threads to read it use System.IO.File.Open method with System.IO.FileShare.Read. Ie.:

    System.IO.File.Open('path.txt',System.IO.FileMode.OpenOrCreate,System.IO.FileAccess.ReadWrite,System.IO.FileShare.Read) 

    Other (reading) threads should use System.IO.FileAccess.Read

    Signature of Open method:

    public static FileStream Open(string path, FileMode mode, FileAccess access, FileShare share); 

    UPDATE If you need all instances to ocasionally write to file. Use Mutex class to reserve file writing. Ie.:

        Mutex mut = new Mutex('filename as mutex name');     mut.WaitOne();     //open file for write,      //write to file     //close file     mut.ReleaseMutex(); 

    Hope it helps.

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

Sidebar

Related Questions

I have an IIS7.5 web-site, on Windows Server 2008, with an ASP.NET MVC2 web-site
I have a asp.net web application which has a number of versions deployed on
I am trying to deploy an ASP.NET application. I have deployed the site to
I have deployed an ASP.NET 4 application to IIS 6 on Windows XP 64bit.
I'm working with a web application I built in ASP.NET MVC. It is deployed
We're developing an ASP.NET MVC 3 website to be deployed on AppHarbor. The site
I have created a website in asp.net and deployed it on IIS. It is
I have deployed a new build on Production server, but I dont see the
I have a web application deployed in an internet hosting provider. This web application
I'm working on a sample project built from the ASP.NET Web Application template (web

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.