NHibernate を使用してデータベースに接続しようとすると、ログインに失敗したというエラーが表示されます。
var config = Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2005
.ConnectionString("Data Source=SERVER1\\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=xxx"))
.Mappings(x => x.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()));
Error 18456 State 5
SQL Management Studio のログ ビューアーで。
しかしsqlcmd
、Management Studio または Management Studio を使用すると、正常に動作します (Windows Auth を使用)。
何が問題なのですか?
EDIT NHibernate 例外:
Test method ProjektLogg.Tests.NHibernateTests.ShouldBeAbleToGenerateFactory threw exception:
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> NHibernate.HibernateException: Login failed for user XXX-INTRANET\username. ---> System.Data.SqlClient.SqlException: Login failed for user XXX-INTRANET\username.