我已经下载了Kigg Asp.net入门套件项目。
然后我将其转换为VS.Net 2010项目,它成功地完成了所有工作。
然后我运行create-kigg数据库,还添加了默认数据。(来自源代码附带的脚本文件)
我的开发环境-64位Win 7操作系统,带有VS.Net 2010和SQL Server 2008
但我还是犯了这个错误。
The underlying provider failed on Open.
"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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
Source: System.Data.Entity
StackTrace:
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
at System.Data.EntityClient.EntityConnection.Open()
at System.Data.Objects.ObjectContext.EnsureConnection()
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Objects.CompiledQuery.ExecuteQuery[TResult](ObjectContext context, Object[] parameterValues)
at System.Data.Objects.CompiledQuery.Invoke[TArg0,TArg1,TResult](TArg0 arg0, TArg1 arg1)
at Kigg.EF.Repository.UserRepository.FindByUserName(String userName) in D:DevEnvSourceEntityFrameworkRepositoryUserRepository.cs:line 94
at Kigg.Repository.DecoratedUserRepository.FindByUserName(String userName) in D:DevEnvSourceCoreRepositoryDecoratedDecoratedUserRepository.cs:line 41
at Kigg.Repository.LoggingUserRepository.FindByUserName(String userName) in D:DevEnvSourceCoreRepositoryDecoratedLoggingLoggingUserRepository.cs:line 59
at Kigg.Repository.DecoratedUserRepository.FindByUserName(String userName) in D:DevEnvSourceCoreRepositoryDecoratedDecoratedUserRepository.cs:line 41
at Kigg.Infrastructure.CreateDefaultUsers.CreateUserIfNotExists(DefaultUser defaultUser) in D:DevEnvSourceCoreInfrastructureBootstrapperCreateDefaultUsers.cs:line 37
at Kigg.EnumerableExtension.ForEach[T](IEnumerable`1 enumerable, Action`1 action) in D:DevEnvSourceCoreExtensionEnumerableExtension.cs:line 14
at Kigg.Infrastructure.CreateDefaultUsers.Execute() in D:DevEnvSourceCoreInfrastructureBootstrapperCreateDefaultUsers.cs:line 28
at Kigg.Infrastructure.Bootstrapper.<Run>b__0(IBootstrapperTask t) in D:DevEnvSourceCoreInfrastructureBootstrapperBootstrapper.cs:line 21
at Kigg.EnumerableExtension.ForEach[T](IEnumerable`1 enumerable, Action`1 action) in D:DevEnvSourceCoreExtensionEnumerableExtension.cs:line 14
at Kigg.Infrastructure.Bootstrapper.Run() in D:DevEnvSourceCoreInfrastructureBootstrapperBootstrapper.cs:line 21
at Kigg.Web.GlobalApplication.OnStart() in D:DevEnvSourceWebGlobal.asax.cs:line 11
at Kigg.Web.GlobalApplication.Application_Start() in D:DevEnvSourceWebGlobal.asax.cs:line 23
它无法找到您的sql server。请在web.config 中检查您的连接字符串