I keep getting the Keyword not supported: ‘file access retry timeout’ error when viewing pages that access my database.
So I’m assuming it can’t access the database. I had this exact same problem just a few moments ago, when viewing my homepage. I changed (in my _AppStart.cshtml file) this:
WebSecurity.InitializeDatabaseConnection("MYDB", etc, etc, etc, etc);
to:
WebSecurity.InitializeDatabaseConnection("Data Source=|DataDirectory|\\MYDB.sdf", "System.Data.SqlServerCe.4.0", etc, etc, etc, etc);
and it worked!
However, when I go to another page, (which tried to access the database from a C# Class, (.cs file) I get the same error!
But, in my C# file (.cs) – I cannot change:
var database = Database.Open("MYDB");
to:
var database = Database.Open("Data Source=|DataDirectory|\\MYDB.sdf", "System.Data.SqlServerCe.4.0", etc, etc, etc, etc);
… because it says:
No overload for method ‘Open’ takes 2 arguments (obviously).
The error (before making the above change in the .cs file:
Server Error in ‘/’ Application.
Keyword not supported: ‘file access retry timeout’. 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.ArgumentException: Keyword not supported:
‘file access retry timeout’.Source Error:
>
> Line 161: foreach(string item in items) Line 162: { Line 163: var
> row = database.QuerySingle("select Suburb, State from
> SuburbsPostCodesAndStates where Suburb = @0", item); Line
> 164: if(row != null) Line 165: {
>
Source File:
c:\HostingSpaces\jpezzime\mysite.com\wwwroot\App_Code\JTSi.cs
Line: 163Stack Trace:
[ArgumentException: Keyword not supported: ‘file access retry
timeout’.]
System.Data.SqlServerCe.SqlCeConnectionStringBuilder.GetIndex(String
keyword) +198
System.Data.SqlServerCe.SqlCeConnectionStringBuilder.set_Item(String
keyword, Object value) +31
System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String
value) +185
System.Data.SqlServerCe.SqlCeConnectionStringBuilder..ctor(String
connectionString) +181
System.Data.SqlServerCe.SqlCeConnection.set_ConnectionString(String
value) +241
WebMatrix.Data.DbProviderFactoryWrapper.CreateConnection(String
connectionString) +96
WebMatrix.Data.<>c_DisplayClass15.b_14()
+16 WebMatrix.Data.Database.get_Connection() +19 WebMatrix.Data.Database.EnsureConnectionOpen() +13
WebMatrix.Data.d__0.MoveNext() +72
System.Linq.Enumerable.FirstOrDefault(IEnumerable1 source) +42322121 items) in c:\HostingSpaces\jpezzime\mysite.com\wwwroot\App_Code\JTSi.cs:163
WebMatrix.Data.Database.QuerySingle(String commandText, Object[] args)
+98 JTSi.FindSetAndRemoveLocation(List
ASP._Page_Shared_Pages_Search_cshtml.Execute() in
c:\HostingSpaces\jpezzime\mysite.com\wwwroot\Shared\Pages\Search.cshtml:17
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +208
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1
executors) +68 System.Web.WebPages.WebPage.ExecutePageHierarchy()
+123 System.Web.WebPages.StartPage.RunPage() +19 System.Web.WebPages.StartPage.ExecutePageHierarchy() +67
System.Web.WebPages.StartPage.RunPage() +19
System.Web.WebPages.StartPage.ExecutePageHierarchy() +67
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase
httpContext) +121——————————————————————————– Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.272
Can anybody please help shed some light on this? I have absolutely no idea how a website can go from totally awesome, to totally screwed up, in just a matter of minutes – when I haven’t even made any changes!
Solution:
replace:
with: