目前我正在部署WCF服务,实体框架访问sqlite数据库。该服务托管在窗口服务下。部署完成后,该服务已创建。我可以从其他机器访问WSDL页面。但是,我无法通过EF从数据库获取数据。当它处于开发环境时,所有工作。在部署到其他macgine之后,当我使用相同的查询时,它会引发错误:无法找到或加载已注册的.Net Framework数据提供程序。用实体框架部署WCF服务的问题
我认为这个问题会涉及到sqlite的东西。我在“远程”机器上安装了.NET Framework 4.5和System.data.SQLite,但我仍然无法工作。有谁知道这个问题的原因?感谢您提前提供任何帮助。
此外,我是否需要在代码中初始化DbProviderFactory以便在app.config文件中使用它?如果是这样,哪里应该是适当的地方插入它们?
这里是窗口服务我的app.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.84.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</DbProviderFactories>
</system.data>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="ServBehave" name="iPhysio_Wcf_Service.Service">
<host>
<baseAddresses>
<add baseAddress="http://86.163.77.253:8733/iPhysio_Wcf_Service/Service/" />
</baseAddresses>
</host>
<endpoint address="soapService" binding="basicHttpBinding" contract="iPhysio_Wcf_Service.IService" />
<endpoint address="XMLService" behaviorConfiguration="restPoxBehavior" binding="webHttpBinding" contract="iPhysio_Wcf_Service.IService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServBehave">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<!--Behavior for the REST endpoint for Help enability-->
<behavior name="restPoxBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<connectionStrings>
<add name="iPhysioAndroidDBEntities1" connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=System.Data.SQLite;provider connection string='data source="C:\Users\SiuWai\Desktop\iPhysioAndroidDB"'" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
您是否在另一台机器上安装了SQLite的相同版本1.0.84.0?你也可以尝试从这里的解决方案:http://stackoverflow.com/questions/1875134/c-sharp-failed-to-find-or-load-the-registered-net-data-provider-error –
我试过这个解决方案,它不起作用。 –
你已经尝试了这个解决方案,并且检查了'System.Data.SQLite.dll'在远程机器上的解决方案的'bin'文件夹中? (也许'msvcr100.dll'以及另一个答案中提到的那样。) –