Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCFTestClient连接字符串错误_C#_Entity Framework_Wcf_Windows Phone 8 - Fatal编程技术网

C# WCFTestClient连接字符串错误

C# WCFTestClient连接字符串错误,c#,entity-framework,wcf,windows-phone-8,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中,

我有一个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?

@Belogix很抱歉,我不理解您的评论。在WCFTestClient中,我添加的服务的地址是IIS托管的服务:好的,因此该服务实际返回的错误是,它无法找到我假定的数据库的连接字符串?完全正确!但这很奇怪,因为如果我从我的WP8仿真器运行程序,它运行时不会出错!错误发生在我运行WTC时,当我直接从设备运行VS2013外部的WP8应用程序时,我遇到了一个错误,因此我正在拼命寻找错误的原因,因为异常返回的错误不允许我了解实际情况。远程服务器返回了一个错误:Notfound!