eu estava tendo erro sempre que apertava o f5 a pagina abria e aparecia um erro, eu segui o exemplo do topico "Erro de Servidor no Aplicativo '/'. no curso Asp.net MVC 5" E agora esta acontecendo outro erro em uma parte do codigo
public IList<Produto> Lista()
{
using (var contexto = new EstoqueContext())
{
return contexto.Produtos.Include("Categoria").ToList();
}
}
System.Data.Entity.Core.ProviderIncompatibleException
HResult=0x80131501
Message=An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.<>c__DisplayClass1.b__0(Tuple3 k)
at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory)
at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection)
at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy
2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet
1.Include(String path)
at System.Data.Entity.Infrastructure.DbQuery1.Include(String path)
at CaelumEstoque.DAO.ProdutosDAO.Lista() in C:\Users\stag012\Documents\Cursos-Benner\ASP.NET\CaelumEstoque\CaelumEstoque\DAO\ProdutosDAO.cs:line 24
at CaelumEstoque.Controllers.ProdutoController.Index() in C:\Users\stag012\Documents\Cursos-Benner\ASP.NET\CaelumEstoque\CaelumEstoque\Controllers\ProdutoController.cs:line 17
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__36(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3c()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass45.b__3e()
Inner Exception 1: ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.
Inner Exception 2: SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Não é possível criar uma instância automática. Consulte o log de eventos do Aplicativo do Windows para obter detalhes do erro. )