C# 当表为1MB时,base.EndInvoke抛出timeoutException
我有一个Silverlight应用程序,它每小时向SQL表添加120行。这是由WCF服务(使用LINQ到SQL)完成的。运行程序12小时后,它会在References.cs(自动创建)中引发异常。这是异常消息:C# 当表为1MB时,base.EndInvoke抛出timeoutException,c#,sql-server-2008,linq-to-sql,silverlight-5.0,C#,Sql Server 2008,Linq To Sql,Silverlight 5.0,我有一个Silverlight应用程序,它每小时向SQL表添加120行。这是由WCF服务(使用LINQ到SQL)完成的。运行程序12小时后,它会在References.cs(自动创建)中引发异常。这是异常消息: The HTTP request to 'http://localhost:64739/SQLService.svc' has exceeded the allotted timeout. The time allotted to this operation may have been
The HTTP request to 'http://localhost:64739/SQLService.svc' has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout.
如果我停止应用程序并在这里重新运行它,它将添加第13个小时的数据,并在第14个小时抛出异常。问题可能与SQL表大小有关,因为当表大小接近1MB时,它会引发第一个超时异常。有什么想法吗
这是捕获异常的地方:
public void EndAddTables(System.IAsyncResult result) {
object[] _args = new object[0];
base.EndInvoke("AddTables", _args, result);
}
这是AddTables代码:
[OperationContract]
public void AddTables(short ID, string temperature, string humidity,
string wind, ...)
{
WeatherDataClassDataContext db = new WeatherDataClassDataContext();
Weather_Info row = new Weather_Info();
row.OfficeID = ID;
row.temperature = temperature;
row.humidity = humidity;
db.Weather_Infos.InsertOnSubmit(row);
db.SubmitChanges();
db.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, db.Weather_Infos);
}