关键字不支持:“服务器” [英] Keyword not supported: 'server'

查看:286
本文介绍了关键字不支持:“服务器”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图编辑我的连接字符串上传我的网站服务器。
我没有真正经历与此有关。我得到这个异​​常:关键字不支持:服务器
这是我的连接字符串:

I've been trying to edit my connection string for uploading my website to a server.
I am not really experienced with this. I got this exception: the Keyword not supported: 'server'.
Here is my connection string:

<add name="AlBayanEntities" connectionString="Server=xx.xx.xxx.xxx,xxxx;Database=AlBayan;Uid=bayan;Password=xxxxx;" providerName="System.Data.EntityClient" />

我试图嵌入这个字符串到我的旧的连接字符串,它工作得非常好地方,但它不适合:•

I've tried embed this string into my old connection string which works very well locally, but it didn't fit : S

推荐答案

有关实体框架(数据库优先或模型第一;当你有一个物理EDMX模型文件),你需要使用一种特殊类型的连接字符串中的哪一个从直ADO.NET连接字符串每个人都提到那么远,不可同日而语

For Entity Framework (database-first or model-first; when you have a physical EDMX model file) you need to use a special type of connection string which is quite different from the straight ADO.NET connection strings everyone else has mentioned so far...

连接字符串必须看起来是这样的:

The connection string must look something like:

<add name="testEntities" 
     connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(local);initial catalog=test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" />

这里面的连接字符串,你会发现提供商连接字符串= 属性,它基本上是你的ADO.NET连接字符串:

Inside this connection string, you'll find the provider connection string= attribute which is basically your ADO.NET connection string:

provider connection string=&quot;data source=(local);initial catalog=test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" 

所以在这里,您需要更改您的服务器名称和其他可能的设置。

So here, you need to change your server name and possibly other settings.

  • 数据源= .... 表示你的服务器(你也可以使用服务器= .....
  • 初始目录= ..... 代表你的数据库(你也可以使用数据库= ....
  • data source=.... stands for your server (you can also use server=.....)
  • initial catalog=..... stands for your database (you can also use database=....)

这篇关于关键字不支持:“服务器”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆