I'm getting this error when debugging using Visual Studio 2013 and local IIS 8. I'm using Entity Framework and the database is not local, it's on a remote Windows Server 2012 running SQL Server 2012
A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
The odd thing is that this doesn't happen when you try to load the website normally, when I'm debugging with Visual Studio (debugging local not remote code) and using the remote testing DB on the same server. I get this error
It executes the first query and gets results, when it executes another one the error occurs. I've searched for hours, tried everything I could find but nothing's working. The other odd thing is that it was working fine just a week ago! I hadn't worked on the project for a week and it was working when I left, I came back and this started happening. I kept looking through the server for any changes, nothing is different. I've never encountered this error before, it just started happening without any changes to the code. The same code runs fine on the server, this error seems to happen only when I'm using Visual Studio or IIS 8 on my machine
Here is the stack trace:
[SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +3278660
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +791
System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) +697
System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() +224
System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() +126
System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() +101
System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value) +46
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +658
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +92
System.Data.SqlClient.SqlDataReader.get_MetaData() +102
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +552
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3114
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +554
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +98
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +307
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +474[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +667
System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +932
System.Data.Objects.ObjectQuery1.GetResults(Nullable
1 forMergeOption) +213
System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +41
1 source) +127
System.Linq.Enumerable.FirstOrDefault(IEnumerable
lambda_method(Closure , ControllerBase , Object[] ) +352
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +266
2 parameters) +35
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
System.Web.Mvc.Async.<>c__DisplayClass42.b__41() +33
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +58
System.Web.Mvc.Async.<>c__DisplayClass39.b__33() +80
System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +58
System.Web.Mvc.Async.<>c__DisplayClass2a.b__20() +32
System.Web.Mvc.Async.<>c__DisplayClass25.b__22(IAsyncResult asyncResult) +185
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +48
System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +27
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +22
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +63
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +22
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +48
System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +48
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
Any help would be very appreciated, thanks in advance
EDIT Just to elaborate on what I've tried:
- Restarting VS
- Restarting local and remote IIS
- Rebooting Windows Server
- Restarting SQL Server
- Checking the query in LINQPad (it works)
- Deleting the edmx Model and recreating it from scratch