Connecting using ASP.NET and EF
Posted: Mon 18 Jun 2012 17:53
Hi,
I am getting an error message when I try to open a connection. It appears that this is because ASP.NET doesn't have the necessary permissions to access the SQLite file.
Does anyone know what file permissions I need to modify to allow the file to be accessed?
I set the connection string using the following property:
private string ConnectionString {
get {
return new EntityConnectionStringBuilder {
Provider = "Devart.Data.Salesforce",
ProviderConnectionString = new SalesforceConnectionStringBuilder { Host = ApiHost, UserId = ApiUsername, Password = ApiPassword, SecurityToken = ApiToken }.ConnectionString,
Metadata = @"res://*/Models.SalesForce.csdl|res://*/Models.SalesForce.ssdl|res://*/Models.SalesForce.msl"
}.ToString();
}
}
TIA
Exception Details: Devart.Data.SQLite.ag: Unable to open the database file
Stack Trace:
[ag (0xe): Unable to open the database file]
Devart.Data.Salesforce.as.a(HeaderOptions A_0) +398
Devart.Data.Salesforce.as..ctor(e A_0) +82
Devart.Data.Salesforce.t.a(u A_0, Object A_1, DbConnectionBase A_2) +95
Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, u A_1, DbConnectionBase A_2) +354
Devart.Common.DbConnectionPoolGroup.a(DbConnectionPool A_0, DbConnectionBase A_1) +79
Devart.Common.DbConnectionPool.a(DbConnectionBase A_0) +91
Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection) +1584
Devart.Common.DbConnectionFactory.b(DbConnectionBase A_0) +255
Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection) +316
Devart.Common.DbConnectionBase.Open() +317
Devart.Data.Salesforce.SalesforceConnection.Open() +546
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +52
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +161
System.Data.EntityClient.EntityConnection.Open() +98
xxx.Services.SalesForceEventService.GetContext() in xxx\Code\Services\SalesForceEventService.cs:24
xxx.Services.SalesForceEventService.GetEvent() in xxx\Code\Services\SalesForceEventService.cs:39
xxx.Web.Controllers.EventController.Login() in xxx.Web\Controllers\EventController.cs:32
lambda_method(Closure , ControllerBase , Object[] ) +97
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
I am getting an error message when I try to open a connection. It appears that this is because ASP.NET doesn't have the necessary permissions to access the SQLite file.
Does anyone know what file permissions I need to modify to allow the file to be accessed?
I set the connection string using the following property:
private string ConnectionString {
get {
return new EntityConnectionStringBuilder {
Provider = "Devart.Data.Salesforce",
ProviderConnectionString = new SalesforceConnectionStringBuilder { Host = ApiHost, UserId = ApiUsername, Password = ApiPassword, SecurityToken = ApiToken }.ConnectionString,
Metadata = @"res://*/Models.SalesForce.csdl|res://*/Models.SalesForce.ssdl|res://*/Models.SalesForce.msl"
}.ToString();
}
}
TIA
Exception Details: Devart.Data.SQLite.ag: Unable to open the database file
Stack Trace:
[ag (0xe): Unable to open the database file]
Devart.Data.Salesforce.as.a(HeaderOptions A_0) +398
Devart.Data.Salesforce.as..ctor(e A_0) +82
Devart.Data.Salesforce.t.a(u A_0, Object A_1, DbConnectionBase A_2) +95
Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, u A_1, DbConnectionBase A_2) +354
Devart.Common.DbConnectionPoolGroup.a(DbConnectionPool A_0, DbConnectionBase A_1) +79
Devart.Common.DbConnectionPool.a(DbConnectionBase A_0) +91
Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection) +1584
Devart.Common.DbConnectionFactory.b(DbConnectionBase A_0) +255
Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection) +316
Devart.Common.DbConnectionBase.Open() +317
Devart.Data.Salesforce.SalesforceConnection.Open() +546
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +52
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +161
System.Data.EntityClient.EntityConnection.Open() +98
xxx.Services.SalesForceEventService.GetContext() in xxx\Code\Services\SalesForceEventService.cs:24
xxx.Services.SalesForceEventService.GetEvent() in xxx\Code\Services\SalesForceEventService.cs:39
xxx.Web.Controllers.EventController.Login() in xxx.Web\Controllers\EventController.cs:32
lambda_method(Closure , ControllerBase , Object[] ) +97
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184