我有一个使用Entity FrameWork Core 2.0.2和SQL Server,Sqlite和PostgreSql提供程序的数据项目(标准2.0)。
I have a data project ( standard 2.0) with Entity FrameWork Core 2.0.2 and SQL Server, Sqlite and PostgreSql providers.
我有三个以上的项目用于在Windows窗体,WPF和UWP中进行演示。
I have more three projects for presentation in Windows Forms, WPF and UWP.
当我运行Windows窗体和WPF时,Entity Framework Core适用于所有提供程序,但是当我尝试在UWP上运行SQL Server提供程序时,会抛出此错误
When I run the Windows Forms and WPF, Entity Framework Core works fine for all providers, but when I try to run the SQL Server provider on UWP, it throw this
方法 EnsureCreatedAsync :
public async Task InitDataBaseAsync(DataBaseConfig config) { using (var db = GetDataContext(config)) { // Postgresql and Sqlite do not throw exception in UWP. await db.Database.EnsureCreatedAsync(); } }我检查了三个平台的连接字符串,连接是相同。
I checked the three platforms connection string, the connection are the same.
有人遇到过这个问题吗?
Has anyone experienced this problem?
推荐答案我更改了连接要使用的字符串 TCP / IP
I changed the connection string to use TCP/IP
之前
Data Source=xpt/SqlServerExpress;Initial Catalog=gestao_eficaz;User ID=sa;Password=somePassword之后
Data Source=127.0.0.1,1433;Initial Catalog=gestao_eficaz;User ID=sa;Password=somePassword也必须启用TCP / sql服务器中的IP连接
It is also necessary to enable the TCP / IP connection in the sql server
stackoverflow/questions/2388042/connect-to-sql-server-2008-with-tcp-ip
现在有效!!!
更多推荐
在UWP应用上将Entity Framework Core与SQL Server一起使用时出错
发布评论