Thursday, July 25, 2013

MySQL + WCF Data Service Error "Failed to find or load the registered .Net Framework Data Provider"

This little thing took me about an hour of angry googling (that's my daily job lately) to fix. So, you want to use WCF Data Services to expose data in your MySQL database. You created a project, added ADO.NET Entity thingy, added WCF Data Service, and this last guy does not work throwing Failed to find or load the registered .Net Framework Data Provider at you.

The only thing you are missing is a reference to MySql.Data.Entity (if only it could add itself automatically like tens of others). Go and add it: References -> Add Reference -> Extensions -> Check MySql.Data.Entity. There are a lot of versions available. My installation required version 6.6.5.0. If you add wrong version, the your server will throw an error that would tell you which version it is looking for.

Enable Verbosely Errors in WCF Data Service

In case you want to see some additional info about the occurred exception (+ its stack trace). There are 3 ways to do this:
  1. You can change your service configuration in InitializeService() method
        
    
        public class MrSophisticatedServer: DataService<TestEntities>
        {
            public static void InitializeService(DataServiceConfiguration config)
            {
                // Make service to report errors in a nice way - doesn't really help....
                config.UseVerboseErrors = true;
    
               ....
          
            }
        }
    
    
    NOTE: There is one problem with this method. It does not work if your service (for some ridiculous reason) is not initialized. Basically, something goes wrong before InitializeService() is called. In this case use method 2 or 3 below.

  2. Add this attribute before your data service class
    
        [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] 
    
    

  3. Add the following to your Web.config
     
    
    
        
          
          
        
        
          
            
              
            
          
        
        
         
    
    
    
    Basically, this also sets IncludeExceptionDetailInFaults to TRUE. You define service behavior and ask your smart-ass computer to use it for your service.

Saturday, February 2, 2013

Download Terminates Because of Unknown Network Error

Recently happened with me: all my downloads (I tried Chrome and Mozilla) terminate after a while because of unknown network error. Pretty irritating, isn't it? After several hours I found the problem which was my anti-virus. I use ESET Smart Security and it does port checking by default. Disabling this option (Advanced Setup -> Web and Email -> Web access and antiphishing protection -> HTTP, HTTPS -> Uncheck Enable HTTP checking) permanently solved my problem with downloads.

I doubt that it is a good idea to disable it permanently. So, I turn it off every time I need to download something larger than 10 MB.

Friday, January 25, 2013

Enable ASP in IIS 7.5

I don't really know why, but when you enable IIS in Windows 7 (as Windows Feature) it does not enable ASP automatically. So, of you have problems with ASP not presenting in IIS Manager, then go to IIS -> WWW Services -> Application Development Features and enable everything there. Here is a good guide with pictures on how to do it: http://www.codeproject.com/Articles/43132/How-to-Setup-IIS-6-0-on-Windows-7-to-Allow-Classic