2013-04-05 92 views
0

我在我的控制檯應用程序中使用實體框架和log4net。這是我的app.config的樣子:更改實體框架和log4net的app.config

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> 
    </configSections> 
    <log4net> 
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> 
     <param name="File" value="C:\\Temp\\Logs\\"/> 
     <param name="RollingStyle" value="Date"/> 
     <param name="DatePattern" value="yyMMdd_HHmm'.log'" /> 
     <param name="StaticLogFileName" value="false"/> 
    <appendToFile value="true" /> 
     <maximumFileSize value="100KB" /> 
     <maxSizeRollBackups value="2" /> 
     <layout type="log4net.Layout.PatternLayout"> 
    <conversionPattern value="%date{MM/dd/yyyy HH:mm:ss} %logger [%thread] (Line :%line) %level - %message%newline"/> 
     </layout> 
    </appender> 
    <root> 
     <level value="DEBUG" /> 
     <appender-ref ref="RollingFile" /> 
    </root> 
    </log4net> 
    <connectionStrings> 
    <add name="CAPDBEntities" connectionString="metadata=res://*/CAPDB.csdl|res://*/CAPDB.ssdl|res://*/CAPDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=caServer;initial catalog=CAPDB;persist security info=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
    <add name="USPDBEntities" connectionString="metadata=res://*/USPDB.csdl|res://*/USPDB.ssdl|res://*/USPDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=UsServer;initial catalog=USPDB;persist security info=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
</configuration> 

我得到一個「ConfigErrorsException was unhandled」錯誤。它指向我設置的我的CAPDBEntities。我需要更改哪些EF & log4net使用相同的app.config文件?

回答

0

我想我明白了這一點。我從Nuget &下載了Entity Framework,重新創建了App.config。它在那之後工作。