ASP.NET MVC 4アプリケーション(コードファースト)をIISに展開しているときに、次のエラーが発生します。
「データベースからプロバイダー情報を取得中にエラーが発生しました。これは、Entity Frameworkが誤った接続文字列を使用していることが原因である可能性があります。詳細については内部例外を確認し、接続文字列が正しいことを確認してください。」
私は答えを探していましたが、どの状況も私のものと一致しません:
私は2つのプロジェクトを手に入れました
- バックエンド(コードファーストを使用したDataAccess + WCFサービス)
- フロントエンドMVC4アプリケーション(WCFサービスへのサービス参照のみ)
私のローカルIIS+SQL Server 2008では、正常に動作します。connectionstringを本番データベースに変更しても、すべてが期待どおりに機能します。
この問題は、バックエンド+フロントエンドをIISに展開するときに発生します。
dbにアクセスする唯一の接続文字列は、私のバックエンドアプリケーションにあります。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="fromMail" value="xxx@gmail.com" />
</appSettings>
<connectionStrings>
<add name="TTCWestelDbContext" connectionString="Data Source=192.168.2.14\SQLSERVER2008;Initial Catalog=TTCWestel001;Persist Security Info=True;User ID=XXX;Password=XXX" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="102400" executionTimeout="3600" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\Temp\WCFTracesTTCWestel.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
助けていただければ幸いです!!
ありがとう
ミクロ