unable to find the requested .net framework data provider. it may not be installed

帅比萌擦擦* 提交于 2019-12-24 17:31:31

问题


I am trying to connect to an informix database on a 64 bit windows 7 pc. I have been able to make the connection just fine on a 32bit pc, but I get the above error when trying to run it on the 64 bit pc. It is looking for the IBM.Data.Informix driver, but says it can't find it. I've got 2 versions of that dll in my GAC - 3.0.0.2 and 9.0.0.2.

Does anyone have any idea how to get this working?

Thanks for any thoughts.


回答1:


I found the issue - I had to edit the machine.config by adding the following lines -

<runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
            <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
                <assemblyIdentity name="IBM.Data.Informix" publicKeyToken="7c307b91aa13d208" culture=""/>
                <bindingRedirect oldVersion="2.81.0.0" newVersion="3.0.0.2"/>
            </dependentAssembly>
            <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
                <assemblyIdentity name="IBM.Data.Informix.3.0.0" publicKeyToken="7c307b91aa13d208" culture=""/>
                <bindingRedirect oldVersion="2.81.0.0" newVersion="3.0.0.2"/>
                <codeBase version="3.0.0.2" href="C:\Program Files\IBM\Informix\Client-SDK\bin\netf20\specific\IBM.Data.Informix.3.0.0.dll"/>
            </dependentAssembly>
        </assemblyBinding>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="">
            <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
                <assemblyIdentity name="IBM.Data.Informix" publicKeyToken="7c307b91aa13d208" culture=""/>
                <bindingRedirect oldVersion="2.81.0.0" newVersion="3.0.0.2"/>
            </dependentAssembly>
            <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
                <assemblyIdentity name="IBM.Data.Informix.3.0.0" publicKeyToken="7c307b91aa13d208" culture=""/>
                <bindingRedirect oldVersion="2.81.0.0" newVersion="3.0.0.2"/>
                <codeBase version="3.0.0.2" href="C:\Program Files\IBM\Informix\Client-SDK\bin\netf20\specific\IBM.Data.Informix.3.0.0.dll"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>  

    <connectionStrings>
        <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    <system.data>
        <DbProviderFactories>
            <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
            <add name="IBM Informix .NET Data Provider" invariant="IBM.Data.Informix" description="IBM Informix Data Provider for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>
            <add name="IBM Informix .NET Data Provider 3.0.0" invariant="IBM.Data.Informix.3.0.0" description="IBM Informix Data Provider 3.0.0 for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.3.0.0, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>
        </DbProviderFactories>
    </system.data>


来源:https://stackoverflow.com/questions/3735498/unable-to-find-the-requested-net-framework-data-provider-it-may-not-be-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!