我刚刚尝试通过WCF和实体框架构建一个N层应用程序。我对所有这些都是新手,所以如果我听起来很无知,请道歉。
我正在尝试测试,当我尝试通过WCF服务查询数据库时,出现了此错误。
指定的命名连接在配置中找不到,不打算与EntityClient提供程序一起使用,或者无效。
我只是将我的连接字符串从Entity Framework项目复制到我的WCF主机web.config,所以我不确定是什么问题。
有什么主意吗?
web.config(网络配置)
<?xml版本=“1.0”?><配置><连接字符串><add name=“AerosPACE_CCADEEntities”connectionString=“metadata=res://*/AerospaceModel.csdl|res://*.AerosPACE Model.ssdl|es://*AerosspaceModel.msl;provider=System.Data.SqlClient;producr connection string=";Data source=***;initial catalog=AerosPACE_CADE;persist security info=True;user id=***;password=***;App=实体框架;“providerName=”系统。数据。实体客户端“/></connectionStrings><system.web><compilation debug=“true”targetFramework=“4.0”/></system.web><system.serviceModel><服务><service name=“AerospaceCCADE.Server.Domain.service.AerosPACE_CADEDataService”><endpoint address=“”binding=“wsHttpBinding”contract=“AerospaceCCADE.Common.Domain.Service.Contracts.IArospacE_CCADEDataService”bindingConfiguration=“WS-AT”/><endpoint address=“basic”binding=“basicHttpBinding”contract=“AerospaceCCADE.Common.Domain.Service.Contracts.IArospacE_CCADEDataService”/><endpoint address=“mex”binding=“mexHttpBinding”contract=“IMetadataExchange”/></服务></服务><绑定><wsHttpBinding><binding name=“WS-AT”transactionFlow=“true”/></wsHttpBinding></bindings><行为><服务行为><行为><serviceMetadata httpGetEnabled=“true”/><serviceDebug-includeExceptionDetailInFaults=“true”/><serviceAuthorization personateCallerForAllOperations=“false”/></行为></serviceBehaviors></行为><serviceHostingEnvironment aspNetCompatibilityEnabled=“false”multipleSiteBindingsEnabled=“true”/></system.serviceModel><system.webServer><modules runAllManagedModulesForAllRequests=“true”/></system.webServer></配置>
客户端App.config:
<?xml版本=“1.0”?><配置><连接字符串></connectionStrings><system.serviceModel><绑定><wsHttpBinding><binding name=“WSHttpBinding_DataService”closeTimeout=“00:01:00”openTimeout=“00-01:00”receiveTimeout=”00:10:00“sendTimeout=bypassProxyOnLocal=“false”transactionFlow=“true”hostNameComparisonMode=“StrongWildcard”maxBufferPoolSize=“524288”maxReceivedMessageSize=“67108864”messageEncoding=“Text”textEncoding=“utf-8”useDefaultWebProxy=“true”allowCookies=“false”><readerQuotas maxDepth=“32”maxStringContentLength=“8192”maxArrayLength=16384“maxBytesPerRead=”4096“maxNameTableCharCount=”16384“/><reliableSession ordered=“true”activityTimeout=“00:10:00”enabled=“false”/><安全模式=“消息”><transport clientCredentialType=“Windows”proxyCredential Type=“None”realm=“”/><message clientCredentialType=“Windows”negotiateServiceCredential=“true”algorithmSuite=“Default”/></security></绑定></wsHttpBinding></bindings><客户端><endpoint address=“http://localhost:5482/AerosPACE_CACADEDataService.svc" binding=“wsHttpBinding”bindingConfiguration=“WSHttpBinding_DataService”contract=“AerospaceCCADE.Common.Domain.Service.Contracts.IArospace_CCADEDataService”name=“AerosPACE_CCADEDataService”/></客户端><行为><端点行为><行为><客户端凭据><!--允许服务器使用客户端凭据进行模拟--><windowsallowedImpersonationLevel=“模拟”/></clientCredentials(客户端凭据)></行为></endpointBehaviors></行为></system.serviceModel><启动><supportedRuntime version=“v4.0”sku=“.NETFramework,version=v4.0”/></启动></配置>