i get this error
Cannot open database “DataLayer.Context.MedicallexiconContext” requested by the login. The login failed.
Login failed for user ‘CL-xcsd-\medicallexicon_web’.
this is my context
public class MedicallexiconContext : MyDbContextBase, IUnitOfWork
{
public DbSet<Word> Word { get; set; }
public DbSet<Category> Category { get; set; }
public DbSet<Language> Language { get; set; }
public DbSet<Picture> Picture { get; set; }
public DbSet<RelationshipBetweenWords> RelationshipBetweenWords { get; set; }
#region IUnitOfWork Members
#region IUnitOfWork Members
public new IDbSet<TEntity> Set<TEntity>() where TEntity : class
{
return base.Set<TEntity>();
}
#endregion
#endregion
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new CategoryConfig());
modelBuilder.Configurations.Add(new WordConfig());
modelBuilder.Configurations.Add(new PictureConfig());
modelBuilder.Configurations.Add(new LanguageConfig());
modelBuilder.Configurations.Add(new RelationshipBetweenWordsConfig());
base.OnModelCreating(modelBuilder);
}
}
and this is my connection string
<add name="MedicallexiconContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MedicallexiconProject-2012615153521;Integrated Security=True" providerName="System.Data.SqlClient"/>
and this is my database name
DataLayer.Context.MedicallexiconContext
It looks like an ASP.Net app is using this code?
Looks like the app pool user is
CL-xcsd-\medicallexicon_web. Make sure that user has appropriate permissions to the database.http://technet.microsoft.com/en-us/library/cc771170(WS.10).aspx
For others that may find this… the default app pool user for IIS 7 is NETWORK SERVICE. If you have not changed the default app pool user, this is the account that needs permission in SQL.
Adding the user to SQL Server