Keyword not supported: #39;server#39;(不支持关键字:“服务器)
问题描述
我一直在尝试编辑连接字符串以将我的网站上传到服务器.
我对此并没有真正的经验.我得到了这个例外:不支持的关键字:服务器".
这是我的连接字符串:
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" />
我尝试将此字符串嵌入到我的旧连接字符串中,该字符串在本地运行良好,但不适合:S
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="data source=(local);initial catalog=test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
在此连接字符串中,您会找到 provider connection string=
属性,它基本上就是您的 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="data source=(local);initial catalog=test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework""
所以在这里,您需要更改您的服务器名称和可能的其他设置.
So here, you need to change your server name and possibly other settings.
data source=....
代表您的服务器(您也可以使用server=.....
)initial catalog=.....
代表您的数据库(您也可以使用database=....
)
data source=....
stands for your server (you can also useserver=.....
)initial catalog=.....
stands for your database (you can also usedatabase=....
)
这篇关于不支持关键字:“服务器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:不支持关键字:“服务器"
基础教程推荐
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- rabbitmq 的 REST API 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- c# Math.Sqrt 实现 2022-01-01