我已经下载了Kigg Asp.net入门套件项目。
然后我将其转换为VS.Net 2010项目,它成功地完成了所有工作。
然后我运行创建kigg数据库并添加了默认数据。 (来自源文件附带的脚本文件)
我的开发环境 - 使用VS.Net 2010和SQL Server 2008的64位Win 7操作系统
但我仍然遇到这个错误。
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:\DevEnv\Source\EntityFramework\Repository\UserRepository.cs:line 94
at Kigg.Repository.DecoratedUserRepository.FindByUserName(String userName) in D:\DevEnv\Source\Core\Repository\Decorated\DecoratedUserRepository.cs:line 41
at Kigg.Repository.LoggingUserRepository.FindByUserName(String userName) in D:\DevEnv\Source\Core\Repository\Decorated\Logging\LoggingUserRepository.cs:line 59
at Kigg.Repository.DecoratedUserRepository.FindByUserName(String userName) in D:\DevEnv\Source\Core\Repository\Decorated\DecoratedUserRepository.cs:line 41
at Kigg.Infrastructure.CreateDefaultUsers.CreateUserIfNotExists(DefaultUser defaultUser) in D:\DevEnv\Source\Core\Infrastructure\Bootstrapper\CreateDefaultUsers.cs:line 37
at Kigg.EnumerableExtension.ForEach[T](IEnumerable`1 enumerable, Action`1 action) in D:\DevEnv\Source\Core\Extension\EnumerableExtension.cs:line 14
at Kigg.Infrastructure.CreateDefaultUsers.Execute() in D:\DevEnv\Source\Core\Infrastructure\Bootstrapper\CreateDefaultUsers.cs:line 28
at Kigg.Infrastructure.Bootstrapper.<Run>b__0(IBootstrapperTask t) in D:\DevEnv\Source\Core\Infrastructure\Bootstrapper\Bootstrapper.cs:line 21
at Kigg.EnumerableExtension.ForEach[T](IEnumerable`1 enumerable, Action`1 action) in D:\DevEnv\Source\Core\Extension\EnumerableExtension.cs:line 14
at Kigg.Infrastructure.Bootstrapper.Run() in D:\DevEnv\Source\Core\Infrastructure\Bootstrapper\Bootstrapper.cs:line 21
at Kigg.Web.GlobalApplication.OnStart() in D:\DevEnv\Source\Web\Global.asax.cs:line 11
at Kigg.Web.GlobalApplication.Application_Start() in D:\DevEnv\Source\Web\Global.asax.cs:line 23
答案 0 :(得分:1)
无法找到您的SQL Server。请检查web.config中的连接字符串