Thursday 4 April 2013

Unable to open physical file



Server Error in '/MyFirstWebApp' Application.


Unable to open the physical file "E:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\App_Data\aspnetdb.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file E:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Unable to open the physical file "E:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\App_Data\aspnetdb.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file E:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Source Error: 

Line 28:     public virtual ShoppingCart.Cart SCart {
Line 29:         get {
Line 30:             return ((ShoppingCart.Cart)(this.GetPropertyValue("SCart")));
Line 31:         }
Line 32:         set {

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\myfirstwebapp\a4c9f484\be3e7329\App_Code.gzb7vl8d.2.cs    Line: 30 

Stack Trace: 

[SqlException (0x80131904): Unable to open the physical file "E:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\App_Data\aspnetdb.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file E:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844759
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
   System.Data.SqlClient.SqlConnection.Open() +122
   System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +87
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +221
   System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc) +772
   System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties) +433
   System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider) +258
   System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) +132
   System.Configuration.SettingsBase.get_Item(String propertyName) +102
   System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36
   System.Web.Profile.ProfileBase.get_Item(String propertyName) +68
   System.Web.Profile.ProfileBase.GetPropertyValue(String propertyName) +7
   ProfileCommon.get_SCart() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\myfirstwebapp\a4c9f484\be3e7329\App_Code.gzb7vl8d.2.cs:30
   MiniCartControl.Page_Load(Object sender, EventArgs e) in e:\Chaitanya\Developing Site\MyFirstWebApp-02-04-2013\MyFirstWebApp\MiniCartControl.ascx.cs:18
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627



Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053


Here I Got This Error Because Of That My Database Which I Am Using In My Project Is Attached With The SQL Server Management Studio. So Already My Database Is Attached With The SQL Server Management Studio And Now I Am Trying To Access My Database Using Visual Studio 2008. So Accessing The Same Database By Two Environments Clashes And The Bug Occurred "Operating system error 32: "32(The process cannot access the file because it is being used by another process.)"" . To Fix This Bug I Had Detached My Database From SQL Server Management Studio...Now the Bug Is Fixed And I Can Access My Database.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.