简体   繁体   English

“用户”登录失败。”

[英]“Login failed for user ''.”

I have a WCF service, I added a database, I'm using EF, but when I try to connect to the database I have this problem... 我有WCF服务,添加了数据库,使用的是EF,但是当我尝试连接到数据库时出现此问题...

public Producenci GetProducent(int id)
{
    dbMagazynierEntities context = new dbMagazynierEntities();
    context.Database.Connection.Open();

    var producent_entity = (from p in context.Producenci
                            where p.ID == id
                            select p).FirstOrDefault();

    context.Dispose();

    if (producent_entity != null)
    {
       return TranslateProducentEntity2Producent(producent_entity);
    }
    else
    {
       throw new Exception("error");
    }
}

I get 我懂了

Login failed for user '.' 用户“。”的登录失败

this is my CS 这是我的CS

<connectionStrings><add name="dbMagazynierEntities" connectionString="metadata=res://*/MagazynierEntity.csdl|res://*/MagazynierEntity.ssdl|res://*/MagazynierEntity.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=PIOTR-TOSH\Piotr;initial catalog=dbMagazynier;integrated security=false;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings></configuration>

Your connection string has 您的连接字符串有

integrated security=false;

So in that fashion you should specify the user id and password in the connection string. 因此,应以这种方式在连接字符串中指定用户ID密码

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

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