Unable to open the physical file "". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".

Posted on 2007-10-01
Last Modified: 2011-10-03
I have a .mdf file in App_Data folder. When I am trying to run the program from my server, I am getting this error:

Unable to open the physical file "". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".

This is my web.config connection:
<add name="hometourConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\hometour.mdf;Integrated Security=True;User Instance=True"
   providerName="System.Data.SqlClient" />

How do I fix it?
Question by:siddhuoops
    LVL 20

    Expert Comment

    how do you access it are you going through a typed dataset?


    Author Comment

    I am using the objectdataSource and yeah I am using a dataset to access it.
    LVL 21

    Accepted Solution

    Do you know if the same MDF is being used by some other application/ service?
    Are you getting this error when you launch the IE through the IDE through the inbuilt web server?
    If you are using VS2005 and you have deployed it to IIS, try closing your IDE and then try accessing it.
    LVL 21

    Expert Comment

    After every use, are you closing the Connection?

    Author Comment

    yeah did it fixed. I closed the IDE and opened the site in my server. This time it worked. So, everytime, I do this, do I always have to close IDE?

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Problem with C# 1 44
    jquery, aspx 10 34
    VBSCRIPT in Page Load C# ASP.NET 6 40
    sort multidimensional array in c# 2 31
    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now