locked
Problem with sdf DB and godaddy hosting RRS feed

  • Question

  • User-1718780412 posted

    I downloaded Web Matrix and used the bakery template to create a site. I changed most of the site. The site used a sdf DB to hold image information for images in the images folder. It has code on the page that pulls image info from the sdf DB each time the page loads. It is nested in a div.

    Due to some of the limitations of Web Matrix I decided to open it in Visual Studio Express 2012 web.

    When I run the site for VS it opens and dispalys great. The images are there and a new one opens each time the page loads. I then published the site to my GoDaddy site. The issue is that there are no images now. When I look at the page source in IE the div is not created. All the other pages are good on the site and since the only one that has any issues also has the code for the sdf DB I assume that there is something wrong.

    Any help would be apperciated.

    Ty (I can post the code if needed)

    Tuesday, April 29, 2014 8:19 PM

Answers

  • User1508394307 posted

    I think it could happen due to following reasons

    0) path to sdf is incorrect

    Make sure that in the web.config file you have correct path like 

    connectionString="Data Source=|DataDirectory|\Database1.sdf" 

    and not a physical path as per your local setup

    1) database file was not copied to App_Data and that App_Data has no both reading and writing enabled

    Use host admin panel or ftp and check App_Data. In host admin panel ensure that read / write access is set to App_Data (or wherever your .sdf file is located). 

    Some people claim that there's a problem when publishing is done via web, use ftp instead.

    2) missing assemblies for SqlServerCompact

    You can try to copy them manually to \bin 

    http://georgedurzi.com/enabling-entity-framework-sql-server-compact-edition-support-on-azure-websites/
    http://usingaspnet.blogspot.de/2013/08/sql-compact-godaddy.html 

    In any case there is some error which you probably cannot see because of using try..catch in the code. If nothing helps, try simple debug code somewhere e.g.

    string path=Server.MapPath(@"~\App_Data\Your.sdf");
    System.Data.SqlServerCe.SqlCeConnection con = new System.Data.SqlServerCe.SqlCeConnection(@"Data Source=" + path); sql.Open(); sql.Close();

    and see if that works.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 30, 2014 2:49 AM

All replies

  • User1508394307 posted

    I think it could happen due to following reasons

    0) path to sdf is incorrect

    Make sure that in the web.config file you have correct path like 

    connectionString="Data Source=|DataDirectory|\Database1.sdf" 

    and not a physical path as per your local setup

    1) database file was not copied to App_Data and that App_Data has no both reading and writing enabled

    Use host admin panel or ftp and check App_Data. In host admin panel ensure that read / write access is set to App_Data (or wherever your .sdf file is located). 

    Some people claim that there's a problem when publishing is done via web, use ftp instead.

    2) missing assemblies for SqlServerCompact

    You can try to copy them manually to \bin 

    http://georgedurzi.com/enabling-entity-framework-sql-server-compact-edition-support-on-azure-websites/
    http://usingaspnet.blogspot.de/2013/08/sql-compact-godaddy.html 

    In any case there is some error which you probably cannot see because of using try..catch in the code. If nothing helps, try simple debug code somewhere e.g.

    string path=Server.MapPath(@"~\App_Data\Your.sdf");
    System.Data.SqlServerCe.SqlCeConnection con = new System.Data.SqlServerCe.SqlCeConnection(@"Data Source=" + path); sql.Open(); sql.Close();

    and see if that works.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 30, 2014 2:49 AM
  • User938738290 posted

    Publish Settings

    Have you checked your publish settings to make sure that your .sdf is actually getting pushed to GoDaddy?  The highlighted option is checked by default, IIRC, and would definitely cause the error you're describing.

    Wednesday, April 30, 2014 12:47 PM
  • User-1718780412 posted

    The file is in the folder on the server. It maybe a permission thing. I am checking that now.

    Wednesday, April 30, 2014 4:33 PM
  • User-1454326058 posted

    Hi TBarton,

    For the images are not display, that maybe the permission issue. Does it works fine after you check the permission?

    If not, please check whether you could connect to the database. I think you need change the Data Source value of the ConnectionString.

    Thanks

    Best Regards

    Monday, May 5, 2014 10:49 PM