SQL Server Compact 4.0 connect slow with invalid HTTP proxy settings

Answered SQL Server Compact 4.0 connect slow with invalid HTTP proxy settings

  • Monday, January 14, 2013 1:52 PM
     
     

    Opening a connection to a local SQL Server Compact 4.0 database file (C#, EF 5.0) takes approx. 15 seconds if either the machine wide proxy settings (netsh winhttp set proxy...) are wrong or the local user's HTTP proxy settings (in Internet Explorer - Options - Connections) are either wrong or set to "Automatically detect proxy settings".

    Why? What is SQL Server Compact doing on the network? It should just open a local database file.


    Additional info: The platform is Windows Server 2008 R2. The application is a 32-bit program.
    • Edited by candritzky Monday, January 14, 2013 2:30 PM
    •  

All Replies

  • Monday, January 14, 2013 4:23 PM
    Moderator
     
     
    Are you using encryption, the the encryption api could be asking for Certificate Revocation lists, I think you can somehow disable in registry.

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

  • Tuesday, January 15, 2013 8:01 AM
     
     

    @ErikEJ: Yes, the database was encrypted. I changed my code (=removed password from connection string) and recreated an unencrypted database, but this doesn't help. I still have the 15 seconds delay.

    This article explains how to disable the Check for publisher's certificate revocation either for through the UI (Internet Options control panel) or through the registry (HKCU\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\State). If I do this, the delay is gone. But this is not an option for as the setting is per-user. I need a machine wide setting.

    I also tried to add a <runtime><generatePublisherEvidence enabled="false"/></runtime> element to my application's .config file and also to the .NET machine.config file (as some people suggested) but this doesn't help either.

    What else can I do?

  • Tuesday, January 15, 2013 8:40 AM
    Moderator
     
     
    You can set the registry key in your app, before you start use SQL Compact, or use a Group policy: http://www.windowsecurity.com/articles/configuring-advanced-ie-settings-using-group-policy.html

    Please mark as answer, if this was it. Visit my SQL Server Compact blog

  • Tuesday, January 15, 2013 9:39 AM
     
     Answered

    Erik, thanks for the ideas.

    I solved my problem by patching the registry setting for the "Check for publisher's certificate revocation" option of the current user during process startup.

    But I consider this only a dirty workaround/hack.

    IMHO the SQL Server Compact dependency on certificates/network/http/proxy and all that stuff is a bug - at least when using unencrypted database files on a local harddisk.

    Hopefully the SQL Server Compact team will consider this for the next SP.