开发者

Database connection issue when deploy on IIS

开发者 https://www.devze.com 2023-03-06 21:32 出处:网络
I have configured 2 connections strings : <connectionStrings> <add name=\"ApplicationServices\" connectionString=\"Data Source=.\\SQLInstance;Initial Catalog=App;Integrated Security=True\" p

I have configured 2 connections strings :

  <connectionStrings>
    <add name="ApplicationServices" connectionString="Data Source=.\SQLInstance;Initial Catalog=App;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="AppEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLInstance;Initial Catalog=App;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>

The project is running well when launched from VS.But deployed on IIS, I 开发者_StackOverflowget "data source keyword not supported" when try to get entities. Membership (so the ApplicationServices connection) works.

Can someone help me to solve this problem ?

Edit : the problem is the same if we use application or web site


I finally found the solution. Connection string are not read from IIS configuration but from the web.config.

When create the deployment package, VS do some magic with web.config because it read from web.release.config. When inspected the generated config file, I have remark thaht " have been replaced by &quot;.

So the generated connection string is not valid and we should replace manually & by &.

Thank you anyway for your help


You have to install .NET framework 3.5/4.0 on the server, and then set your web application to use it , then IIS should be able to recognize Entity Framework connection string

Edit:

Database connection issue when deploy on IIS

0

精彩评论

暂无评论...
验证码 换一张
取 消