Connecting using ASP.NET and EF

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
enashnash
Posts: 2
Joined: Mon 18 Jun 2012 17:39

Connecting using ASP.NET and EF

Post by enashnash » 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Connecting using ASP.NET and EF

Post by Shalex » Wed 20 Jun 2012 12:59

When dotConnect for Salesforce application is used in partially trusted code (this is actual for web projects), it requires medium trust level.

enashnash
Posts: 2
Joined: Mon 18 Jun 2012 17:39

Re: Connecting using ASP.NET and EF

Post by enashnash » Wed 20 Jun 2012 13:13

Thanks, but my code is running in full trust.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Connecting using ASP.NET and EF

Post by Shalex » Thu 28 Jun 2012 16:03

Thank you for your report. We have reproduced the problem. We will investigate it and notify you about the results as soon as possible.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Connecting using ASP.NET and EF

Post by Shalex » Mon 09 Jul 2012 11:35

If the Data Cache and Metadata Cache connection string parameters are not set, the default folder for the corresponding databases is AppData of the current user. But ASP.NET application does not have an access to this folder. Please set these parameters explicitly and specify the folder, to which your ASP.NET user has the read/write access. For example: "Data Cache=c:\\MyWebApp\\1.db;Metadata Cache=c:\\MyWebApp\\1_metadata.db;". Notify us about the results.

bezpal
Posts: 6
Joined: Tue 21 Nov 2017 17:27

Re: Connecting using ASP.NET and EF

Post by bezpal » Tue 19 Dec 2017 16:46

If I may :)
default location for scheduled job is ...\Users\Default\AppData\Roaming
If you specify location, service account needs Read, Write, and Delete permissions on that folder

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Connecting using ASP.NET and EF

Post by Shalex » Thu 21 Dec 2017 11:15

bezpal, have you encountered any issue with cache files? Is an investigation from our side required?

Post Reply