Lightswitch + WCF RIA + MySQL connector/Net almost working but not quite
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 W开发者_如何学JAVACF 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?
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
精彩评论