RIA Services 'NotFound' exception (MySQL connector)

Discussion in 'Site Programming, Development and Design' started by SeanB, Jan 6, 2011.

  1. Hi

    I am developing a Silverlight 4 site which uses RIA Services. I am using a MySQL database hosted on Winhost.

    When I run my code locally everything works fine. However when I publish to Winhost using Visual Stuido 2010 I get an error, which can be seen by going here:


    When I go to the URL of the actual service that I am calling, here:


    I get another error that doesn't really give me much more information.

    I am new to SL4 and RIA Services, I'm normally a desktop developer, and I don't have a clue as to why this code would work locally and not on the server, unless I am missing an assembly or a config entry somewhere.

    Can anybody help with this?
    Last edited by a moderator: Oct 14, 2015
  2. Just for further info, all of my three entities have a key defined in the metadata like this:

    [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]

    I have Googled the 'no key' error and indications are that there might be a problem wth versions of RIA services on my machine compared to the remote machine?
  3. I've just done some tinkering with the authentication setup after I found an error in Fiddler that said there should only be one authentication method set up and there was more than one. So authentication is currently set to anonymous.

    This has changed the error coming from the service to a 'null reference error', and the same error is shown in Fiddler when I try to load the pages.

    It seems this error is caused by the following entry in my web.config file:

    <remove invariant="MySql.Data.MySqlClient"/>
    <add name="MySql Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"
    type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=, Culture-neutral, PublicKeyToken=c5687fc88969c446"/>

    When I comment out this section the error is 'Schema specified is not valid. Errors: SLDevModel.ssdl(2,95) : error 0175: The specified store provider cannot be found in the configuration, or is not valid.'

    I have uploaded the MySql.Data assembly to my /bin directory so it should be found.

    Tearing my hair out a bit now....
  4. Ray


    The errors does lead me to believe that you are not connecting to the MySQL server correctly. What other assemblies did you add? Remember if you add the MySQL.Data assembly the version we have installed on our servers GAC is version 6.2.3.
  5. Hi

    I have the following libraries in the bin directory of my application:


    Alongside the library for the application itself obviously.
  6. Ray


    Check your local computer and look at your computers GAC. What assembly does it have installed on the GAC that you have not uploaded to your applications Bin folder. I suspect that you have something on your computer that is making it work that we do not have installed on our server. If it is a .Net assembly then it should be Bin deployable.
  7. A bit of extra information...

    I'm connecting OK to the MySQL database using the connector as I am also using the databse for the membership/roles/profile data and I am able to log in using forms authentication. I'm only getting the error from the domain service, it seems it is this that is not able to connect to the database.
  8. This statement would suggest that I upload every bin deployable assembly that is in my GAC and not in my application.... I'm guessing you mean upload all assemblies that my application references.... I was actually just about to try that.
  9. I have uploaded all referenced assemblies, with the exception of core framework assemblies which I must assume are already in the GAC, to the bin directory of my application. This has not resolved the issue.

    I have reinstated the 'DbProviderFactories' section to my web.config file, as I believe this is the reason for the 'Schema specified is not valid' error. This means the service is now giving the previous 'Null reference' exception.

    I am no closer to resolving this and frankly I'm ready to bin the lot.
  10. Ray


    Give me a copy of your connection string. If you are sensitive to your db login and password you can asterisks them out but make sure you keep everything else exactly how you have it on your applications web.config file.
  11. The connection string, which was generated by Entity Framework for me, is

    <add name="mysql_18417_devEntities" connectionString="metadata=res://*/SLDevModel.csdl|res://*/SLDevModel.ssdl|res://*/SLDevModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=my01.Winhost.com;User Id=********;password=********;Persist Security Info=True;database=mysql_18417_dev&quot;" providerName="System.Data.EntityClient" />

    The provider mentioned in the string matches the entry I have put in the DbProviderFactories tag, I have done this as I am using a different version of the MySQL connector to the one installed in the GAC.
    Last edited by a moderator: Oct 14, 2015
  12. Ray


    Try updating the provider



  13. If I do that then it doesn't even run locally, I get the error:

    'The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid'.

    I get the same error when I try to run it on the remote server.
  14. Ray


    The fact that the original error 'null reference error' still leaves me to believe that for some reason your application that is uploaded to our web server is not connecting to the MySQL server correctly, but its really hard to troubleshoot because of all the other things running in the background. Try this. Create a separate folder on the root and set it as an application folder. Create a simple web service to connect to the MySQL data source. Hopefully by focusing on this without all the other functions occurring in the background we may be able to see more clearly the root cause of the problem.
  15. What other things running in the background are you referring to? This is currently a very simple site - the initial page makes a request via a service for some data. It doesn't do very much else - not sure how much simpler I could make it. Or do you mean create an ordinary (not RIA) web service? Not sure how that would help if so.
  16. Ray


    I was referring to the membership/roles provider and any other function that your application maybe running. I think if we get this running


    that things will be more clearer. But your web config probably has other things in it that makes it a little hard to read and break down.
    Last edited by a moderator: Oct 14, 2015
  17. Ray


  18. OK, I have finally solved this.

    The problem was with the MySql.Data.Entity assembly in version 6.3.5 of the connector - it seems it has been compiled incorrectly and references an incorrect version of MySql.Data (it references version 6.3.4). I discovered this after uploading this file to my bin directory (having read the same post that you pointed out) and getting a manifest error.

    I have changed to version 6.3.6 which has just recently been released to resolve this issue, uploaded the new versions of the three MySql files and lo and behold data access using the Entity Framework works fine.

    Thank you very much indeed for your input on this issue, if it hadn't been for you I would have just given up and this problem with the connector would never have come to light - and I would have gone back to desktop development!
  19. Thanks for posting that. It's valuable information.

Share This Page