我正在尝试通过 WCF RIA 服务从 Lightswitch RTM 连接到现有的 MySQL 数据库。
我执行了以下操作:
- 在我的开发计算机上从 MySQL 开发人员专区安装 MySQL 连接器版本 6.3.7。最新版本 6.4.3 似乎不起作用,并在从 Visual Studio 中建立连接时给出错误“与服务器不同步”。
- 通过创建新的数据连接、选择 MySQL 数据库作为提供程序并提供 MySQL 服务器 IP 地址、用户名和密码来测试 Visual Studio 中的连接。
这有效并且数据库显示正确。
然后我按照此处的教程使用创建 WCF RIA 服务
这工作正常。实体图显示了数据库中三个选定的表以及所有字段。
然后我按照本教程将 WCF RIA 服务连接到 lightswitch 此处:
- 在 Lightswitch 项目中,创建新数据源并将其附加到 WCF RIA 服务
- 添加对 WCF RIA 的引用网络项目并选择所需的数据源对象。这有效并且数据源对象已正确导入。
- 最后将连接字符串从 WCF RIA Web 项目文件 App.config 复制到 Lightswitch 项目的服务器生成项目中的文件 web.config。该行是:
可以毫无错误地构建解决方案。但是,当运行 Lightswitch 应用程序时,MySQL 表的详细信息屏幕仅显示红叉,并表明无法加载数据。
我怀疑粘贴到 web.config 的连接字符串是错误的。
上述方法有什么错误/缺失,或者如何隔离和调试问题?
I'm trying to connect to an existing MySQL DB from Lightswitch RTM through a WCF RIA service.
I did the following:
- Install MySQL connector version 6.3.7 from MySQL developer zone on my development machine. The lastest version 6.4.3 does not seem to work and gives an error "Out of sync with server" when establishing a connection from within Visual Studio.
- Test the connection from Visual Studio by creating a new data connection, selecting MySQL database as provider, and providing the MySQL server IP address, the user name and password.
This works and the DB shows up correctly.
Then I followed the tutorials here to use create a WCF RIA service:
- Add a new project to the solution based on the template WCF RIA Services class library.
-
Add an ADO.NET entity data model to the WCF RIA Web project and using the wizard connect it to the MySQL database. The generated connection string is
metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=MySql.Data.MySqlClient;provider connection string="server=10.192.xx.yy;User Id=xxxxxxx;database=projet;password=xxxxxxxxxx;Persist Security Info=True"
.
-
Add a domain service to the WCF RIA Web project.
This works correctly. The entity diagram shows the three selected tables of the database with all fields.
Then I connected the WCF RIA service to lightswitch following this tutorial here:
- In the Lightswitch project, create a new data source and attach it to the WCF RIA service
- Add a reference to the WCF RIA Web project and select the required data source objects. This works and the data source objects are correctly imported.
- Finally copy the connection string from the WCF RIA Web project file App.config to the file web.config in the server generated project of the Lightswitch project. The line is:
<add name="b70821ef-..." connectionString="metadata=res:///Model.csdl|res:///Model.ssdl|res://*/Model.msl;provider=MySql.Data.MySqlClient;provider connection string="server=10.192.xx.yy;User Id=xxxxxxx;database=projet;password=xxxxxxx;Persist Security Info=True"" providerName="System.Data.EntityClient"/>
The solution can be built without errors. However, when running the Lightswitch application, the details screen for the MySQL table only shows a red cross and indicates that it cannot load the data.
I suspect that the connection string pasted to web.config is wrong.
What is wrong/missing in the above approach or how can I isolate and debug the problem?
发布评论
评论(1)
关注这个帖子。
http://lightswitchhelpwebsite.com/Forum/tabid/63/aft/89 /Default.aspx
对我来说,这是解决方案 -> 配置的最后一点
请参阅有关连接字符串
Follow this post.
http://lightswitchhelpwebsite.com/Forum/tabid/63/aft/89/Default.aspx
For me it was the solution-> see the last point about config of coonection string
regards