简体   繁体   English

更新数据库期间用户登录失败

[英]Login failed for user during update-database

I have a big problem.我有一个大问题。 I tried to use another solution but didn't help me.我尝试使用另一种解决方案,但没有帮助我。 I try to make initial migration (code-first workflow) to database which is on my computer.我尝试对我计算机上的数据库进行初始迁移(代码优先工作流程)。 I used commands in PM like enable-migrations, then add-migration NameMigration , then update-database and at this moment I have an error like:我在 PM 中使用了命令,例如 enable-migrations,然后是 add-migration NameMigration ,然后是 update-database,此时我有一个错误,例如:

Error Number:4060,State:1,Class:11
Cannot open database "CodeFirstDemo.Program+BlogDbContext" requested by the login. The login failed.
Login failed for user 'SZYMON\Szymon'.

My config:我的配置:

<entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
  <connectionStrings>
    <add name="BlogDbContext" connectionString="Data Source=SZYMON\BASE; Initial Catalog=CodeFirstDemo; Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
  </connectionStrings>

Database is not exist yet.数据库还不存在。 My object explorer in MS SQL Server looks enter image description here我在 MS SQL 服务器中的 object 资源管理器看起来在此处输入图像描述

Server properties looks enter image description here服务器属性看起来在此处输入图像描述

I don't know what is wrong.我不知道出了什么问题。 Please help me to solve problem.请帮我解决问题。

It does not seem that you have access to the database server.您似乎无权访问数据库服务器。 Try to login using SQL Management Studio to SZYMON\BASE db server using windows authentication.尝试使用 SQL Management Studio 登录到使用 windows 身份验证的 SZYMON\BASE 数据库服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM