Silverlight Business Application Woes

Discussion in 'Silverlight' started by system2, Oct 20, 2010.

  1. I've created a Silverlight 4 application using the "Silverlight Business Application" template in Visual Studio 2010. I've also restored a backup of my SQL Server 2008 database to the discountasp.net server.

    I have modified the connection string in my Web.Config file to connect to the SQL databse on the discountasp.net server.

    The application makes use of WCF RIA services to access the database.

    When I bring up the Silverlight application, anytime the application makes a call to the database, I get an error stating (in one case) "Load operation failed for query 'GetClients'. Keyword not supported:'data source'.

    Has anyone posted a tutorial on how to take just a basic Silverlight 4 Business application that uses WCF RIA services to access a database and getting it to work on a discountasp.net server?

    Or does anyone have any insight into what might be my problem?

    Any help is greatly appreciated.
     
  2. Hello,

    Based on your message I would first look at the syntax of the connection string in your web.config file. Feel free to post it if you want.

    Does your application run in the development server? If so, it may be that your web.config needs modification to work on the deployment server. Look into something called web.config transformation... there is good information in the forums here.

    That is where I would start.

    Good luck,

    Randy
     
  3. mjp

    mjp

    Thanks for the link.
     
  4. Thanks for the replys. I found the solution

    The problem was indeed in my connection string.

    I thought (incorrectly) that I could simply replace the entire connection string in my Web.Config file with the connection string displayed in the discountasp.net control panel.

    The default connection string created by the Silverlight Business application template contains references to the schema. Here is an example:

    <add name="System2RetireEntities" connectionString="metadata=res://*/Models.S2R.csdl|res://*/Models.S2R.ssdl|res://*/Models.S2R.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=BRYAN-W7-PC\SQLEXPRESS;Initial Catalog=System2Retire;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

    If you notice, there is a second connection string embeded within the first surrounded by &quot at the beginning and end.

    Once I replaced only what was between the two &quot tags and left the information referring to the metadata at the beginning of the string, it worked!

    Here is the modified connection string:

    <add name="System2RetireEntities" connectionString="metadata=res://*/Models.S2R.csdl|res://*/Models.S2R.ssdl|res://*/Models.S2R.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=tcp:sql2k804.discountasp.net;Initial Catalog=SQL2008R2_773860_s2r;User ID=[my_username];Password=[my_password];&quot;" providerName="System.Data.EntityClient" />

    I hope someone else finds this helpful.
     
  5. mjp

    mjp

    Hey, thanks for posting the follow up. It will help someone.
     

Share This Page