I'm trying to create a blog with ASP.NET MVC. I'm following this guide
At the middle of the guide (page 7) we test the app, but we have to change the connection string.
Since I don't have a database set up, I was hopping the connection will create it automatically, but it is not.
<add name="BlogDbConnString" connectionString="Data Source=WATCHTOWER\SQLEXPRESS;Initial Catalog=Blog;Integrated Security=True" providerName="System.Data.SqlClient"/>
I also have my user set with no password:
<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="2880">
<credentials passwordFormat="Clear">
<user name="XXXXX" password=""/>
</credentials>
</forms>
</authentication>
When I try to run the app, I get an error in the code where the Ninject is supposed to create the DB:
public class RepositoryModule : NinjectModule
{
public override void Load()
{
Bind<ISessionFactory>()
.ToMethod(e => Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("AngelAlferezBlogDbConnString")))
.Cache(c => c.UseQueryCache().ProviderClass<HashtableCacheProvider>())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Post>())
.ExposeConfiguration(cfg => new SchemaExport(cfg).Execute(true, true, false)) //<===THIS LINE!
.BuildConfiguration()
.BuildSessionFactory())
.InSingletonScope();
Bind<ISession>()
.ToMethod((ctx) => ctx.Kernel.Get<ISessionFactory>().OpenSession())
.InRequestScope();
}
}
And a Hibernate exception saying:
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: 26 - Error Locating Server/Instance Specified)
Anyone can guess what am I doing wrong?