Connection string error, website won't load...

Topics: Business Logic Layer
Aug 3, 2014 at 1:55 PM
Last night I uploaded my BlogEngine site to my hosting service. I had set up a sub-domain so that I could send the link to a friend for review and not have the BlogEngine live to the public. I got this error after I uploaded all of the code:
Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or
unsupported form of compression.
I contacted my hosting service and had the tech help me find the problem. According to him it is this string:
<add name="BlogEngine" connectionString="Server=.\SQLEXPRESS;Database=BlogEngine;
Trusted_Connection=True;" providerName="System.Data.SqlClient" /> 
which is in the web.config file. The thing is that I did NOT set that string to use SQL, in fact, I didn't change ANYTHING of the initial code in the web.config! I wanted it to use the XML. (sigh) Does anyone have any info on how to fix this so that it will work on my hosting service? Any help would be greatly appreciated. TIA,

Aug 3, 2014 at 3:50 PM
No idea why would that be a problem and how it related to the error, but if you not use DB you can remove it.
Aug 3, 2014 at 4:22 PM
Hi Coleenh,

On the rare occasions when I get that error, I find when I do a restart of the app_pool 99.9% of the times will make that error go away.

In your control panel if your control panel has it should have some button for stopping and starting your app_pool and website.

I would try to stop both first.

Let it sit for about 30 secs or so.

Then start the app_pool and then the website.

Give it another 30 secs and take a look at the site.

That should fixed the issue, I believe it is caused by the app cache some how it got messed up and just needs to be cleared out.

For making your site "private" you can edit the anonymous role to only can rate posts, and then unchecked all of the other rights.

That will force all users to have to login into BE before being able to view it this making it "private" :)

Let me know if this fixes the issue.
Aug 3, 2014 at 8:33 PM
Thanks for the responses. rtur, I checked the zipped downloaded file web.config, and this is exactly how that line of code looks in the zipped field:
    <clear />
    <add name="BlogEngine" connectionString="Server=.\SQLEXPRESS;Database=BlogEngine;Trusted_Connection=True;"
 providerName="System.Data.SqlClient" />
    <!--<add name="BlogEngine" connectionString="Data Source=localhost;User ID=usernmae;Password=password;persist 
security info=False;initial catalog=BlogEngineFileStore;" providerName="System.Data.SqlClient"/>-->
I never made any changes to it what-so-ever. kbdavis - thanks, but it works perfectly on my localhost, it just does not work when I upload it to the hosting service. I was on-line with the hosting service "Chat" help service and that is the line of code the tech said was causing the problem.

So if this should work without changing any code - I am stumped as to how to get it to work on my hosting service. Any help would really be appreciated. Thanks!
Aug 3, 2014 at 9:34 PM
Hi Coleenh,

Clearing the app cache on the server is what needs to be done to solve your issue :)

Locally when you run BE every restart clears the cache for you, because the application is restarted.

On the server how long the app goes with out a restart is unknown.

I find clearing the app cache on the server side 99% solves the issue.

The other 1% of the time there is something wrong with the files you uploaded, if you use FTP and upload the files one by one with an FTP client you will get those errors too.

In that case what I do is zip up the root folder UserName/SiteName/wwwroot <--- Zip the wwwroot folder.

Once it is zipped I delete everything that is in there.

Then I would zip my local copy.

Then upload the zip folder through FTP to server, Keyword 1 Zip Folder.

Then once that zip folder is on the server unzip it.

Now that would work.

Using both methods will fix your error 100% of the time :)

I had installed 100's of versions of BE on our server, for the last 3 years, so I have lots of trial and error experience in getting BE to work on the server :)

BE can work perfectly locally, but when you upload to Server can be different and not work.

In these cases in "trouble" shooting steps you got to think in terms

What is different from Live Server vs Local?

If one works in one but not the other clearly points to the issue being on one side and not BE itself.

Another step would be to zip the folder on the server like I explained before but this time download that zip folder.

Unzip it locally and try to run it locally.

If it works locally but not on server again points to the server being at fault and not your BE set up or settings.

On the error:

Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or
unsupported form of compression.

That has nothing to do with your connection string :)

I bet it is your app cache that needs to be cleared :)
Marked as answer by Coleenh on 8/4/2014 at 6:52 AM
Aug 3, 2014 at 10:29 PM
Thank you so much kbdavis, I really appreciate your help! I'll go try that now and also contact the tech support at my hosting service if it doesn't work. I'll let you know what happens. :-D
Aug 3, 2014 at 11:58 PM
Well after stressing about this most of the day you are right (as usual) KBDavis - although it wasn't a matter of clearing the cache, it was extremely simple, and the tech this morning SHOULD have caught this. it was simply turning off the HTTP Compress From the Hosting CP. Thanks very much for your help - it was me mentioning that you said it was probably the cache that had the tech go look at it, and Tah-dah!! It worked!
Marked as answer by Coleenh on 8/4/2014 at 6:52 AM