WCFTestClient ConnectionString错误

时间:2014-10-22 14:49:11

标签: c# entity-framework wcf windows-phone-8

我有一个WCF服务,当我从我的模拟器中使用它或从我的诺基亚520通过VS2013调试运行时,它可以正常工作。

我在没有VS2013调试的情况下尝试连接时遇到错误,现在我正在尝试使用WCFTestClient来测试我的WCF服务。

当我点击我的服务的任何方法时,我收到此错误:

No connection string named 'SegurancaEntities' could be found in the application config file.

在我的服务app.config中,我有这个连接字符串,如下所示:

 <system.web>
   <compilation debug="true" />
</system.web>
<system.serviceModel>
  <diagnostics>
      <messageLogging logMalformedMessages="false" logMessagesAtServiceLevel="false"
          logMessagesAtTransportLevel="false" />
  </diagnostics>
  <bindings>
      <basicHttpBinding>
          <binding name="basicBinding" maxReceivedMessageSize="2147483647"/>
      </basicHttpBinding>
  </bindings>
  <services>
      <service behaviorConfiguration="Metadata" name="WCFDataLibrary.EnvioDados">
          <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="basicBinding" contract="WCFDataLibrary.IEnvioDados" />
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          <host>
              <baseAddresses>
                  <add baseAddress="http://vm-2008-srv/WCFDataService/EnvioDados" />
              </baseAddresses>
          </host>
        <!--<identity>
          <dns />
        </identity>-->
      </service>
  </services>
<behaviors>
  <serviceBehaviors>
    <behavior name="Metadata">
      <serviceMetadata httpGetEnabled="true" httpGetUrl="http://vm-2008-srv/WCFDataService/meta" />
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    </serviceBehaviors>
</behaviors>
    </system.serviceModel>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="SegurancaEntities" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=vm-2008-srv;initial catalog=Seguranca;User Id=xxx;Password=xxx;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

为什么我无法在我的服务上运行WCFTestClient?

0 个答案:

没有答案