简体   繁体   中英

Entity Framework Deployment Issues

Entity Framework is new to me i follow the example below to create a wcf service with entity framework.

Introduction for Entity Framwork for Beginner

It is pretty simply, all the thing was like auto generated, my database was located in my app_data folder. So after go it running in visual studio, I want to publish and deployment to IIS server.

But when I try to run it in server, it return me this error

The underlying provider failed on Open.
   at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
   at System.Data.EntityClient.EntityConnection.Open()
   at System.Data.Objects.ObjectContext.EnsureConnection()
   at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

here is my connectionstring in web.config

<connectionStrings>
    <add name="BPMCommonEntities" connectionString="metadata=res://*/BPMCommonDB.csdl|res://*/BPMCommonDB.ssdl|res://*/BPMCommonDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\BPMCommon.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

I havent change anything in it, and doesn't know what to change either.

What am I missing? where is this error coming from, what should i change to fix this?

当您在本地计算机上工作时,您有SQLExpress托管您的数据库,当您将其部署到服务器时,您需要一个数据库服务器来托管您的数据库,并且您可以将。\\ SQLExpress替换为您的服务器名称。

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