简体   繁体   中英

Entity Framework connection string error

I have this connectionstring in app.config

 <appSettings>
 <add key="CBREEntities"  value="metadata=res://*/CBRE.csdl|res://*/CBRE.ssdl|res://*/CBRE.msl;provider=System.Data.SqlClient;provider connection string='data source=.\SQLEXPRESS;initial catalog=aqp4ewzly1-bp_toolkit_prd_0006-20160923T050628Z;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework'" />
 <add key="elmah-sqlserver" value="data source=.\SQLEXPRESS;initial catalog=aqp4ewzly1-bp_toolkit_prd_0006-20160923T050628Z;integrated security=True;MultipleActiveResultSets=True" />
 </appSettings>

and this in web.config.cshtml

<connectionStrings>
   <add name="CBREEntities" connectionString="@Model["CBREEntities"]" providerName="System.Data.EntityClient" />
   <add name="elmah-sqlserver" connectionString="@Model["elmah-sqlserver"]" providerName="System.Data.SqlClient" />
</connectionStrings>

Entity framework generates this connection string in web.config file

<connectionStrings>
    <add name="CBREEntities" connectionString="metadata=res://*/CBRE.csdl|res://*/CBRE.ssdl|res://*/CBRE.msl;provider=System.Data.SqlClient;provider connection string='data source=.\SQLEXPRESS;initial catalog=aqp4ewzly1-bp_toolkit_prd_0006-20160923T050628Z;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />
    <add name="elmah-sqlserver" connectionString="data source=.\SQLEXPRESS;initial catalog=aqp4ewzly1-bp_toolkit_prd_0006-20160923T050628Z;integrated security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>

and after running app I have this error

It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING

already tested replacing ' with " and replacing entityclient to sqlclient

Try delete your connectionStrings in your web.config.cshtml

I'd never put connectionstring in web.config.cshtml and all my applications woks fine.

I hope help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM