在WCF中添加服务引用失败

时间:2014-07-25 10:42:24

标签: wcf

我的解决方案是有3个项目,1个用于linq和.dbml,1个网站和1个WCF服务。 WCF服务项目中有许多WCF服务,每个WCF都有单独的接口和类文件。我根据项目要求添加了一个WCF。 WCF构建和部署成功,我将WCF项目设置为启动项目运行解决方案,然后它说服务已启动。

我尝试在WebSite中添加此WCF服务的引用,发现按钮在解决方案中可用的服务列表中显示新添加的WCF。

我找到了我的服务,给出了一个合适的名称并添加了,然后错误消息出现在窗口的左下角"添加服务引用失败"

没有显示其他错误或详细信息。

请帮忙!

这是服务项目的App.Config

<service behaviorConfiguration="WCFSrv.ServiceBehavior"
    name="WCFSrv.SalesMIReportService">
    <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IReportDataProvider">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/SalesMIReportService/" />
      </baseAddresses>
    </host>
  </service>



<behaviors>
  <serviceBehaviors>
    <behavior name="WCFSrv.ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />

    </behavior>

  </serviceBehaviors>
</behaviors>




<bindings>

  <wsHttpBinding>
    <binding name="WSHttpBinding_IDriverSalesService" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        bypassProxyOnLocal="false" transactionFlow="true" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
        allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"
          enabled="false" />
      <security mode="None">
        <transport clientCredentialType="Windows" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

以下是完整的App.config

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name=Global.Diagnostics.Properties.Settings" type="System.Configuration.ClientSettingsSection="", System="", Version="2.0.0.0", Culture="neutral", PublicKeyToken=b77a5c561934e089" requirePermission="false="""/>
    </sectionGroup>
  </configSections>
  <appSettings>
    <add key="databaseServer" value="DBSERVER\DEV1P1"/>
    <add key="EventLogSource" value=""/>
    <add key="EventLogName" value=""/>
    <add key="ClientSettingsProvider.ServiceUri" value=""/>
    <add key="DocumentLocation" value="X:\\\Client\Web\Site\pdf"/>
    <add key="Proxy" value="172.22.53.35"/>
    <add key="COMServiceLocatorUrl" value="http://iisdbhxv04/COMServiceLocator/COMServiceLocator.asmx"/>

    <!--***********************************************
       The AppSetting Keys used to EPYX CodeVehicleService
    ***************************************************-->
    <!--Move properties to LIA-->
    <!--Ids for the service booking components-->
    <add key="1LinkServiceId" value="1" />
    <add key="connectServiceId" value="2" />
    <!--Proxy Server Settings (outbound security credentials)-->
    <add key="liveServer" value="false" />
    <add key="proxyServer" value="http://172.22.55.35:80" />

    <!--The type of Code booking that will be done. The value of this setting can be either "Connect" or "Downtime"-->
    <!--<add key="CodeBooking" value="Connect"/>-->
    <add key="CodeBooking" value="Downtime" />
    <!--Test credentials for Code Booking -->
    <add key="CodeOriginatorId" value="8" />
    <add key="CodePassword" value="XMLTEST" />
    <!--Test Components -->
    <add key="CodeNetworkBookingService" value="https://www.1link.com/uk/test-hn/site/OperatorIntegration.asmx" />


  </appSettings>

  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Warning, Error" propagateActivity="true">
        <listeners>
          <add name="xml"/>
        </listeners>
      </source>
    </sources>

    <sharedListeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\temp\Traces_.svclog"/>
    </sharedListeners>

  </system.diagnostics>

  <system.web>
    <compilation debug="true"/>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
      </providers>
    </roleManager>
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
    </diagnostics>
    <extensions>
      <behaviorExtensions>
        <add name="ServiceErrorHandler" type="Global.ServiceModel.ServiceErrorHandlerBehaviorExtensionElement", Temp.Global.ServiceModel="", Version="1.0.0.0", Culture="neutral", PublicKeyToken=null"/>
      </behaviorExtensions>
    </extensions>

    <services>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.Service">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.ICommon">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/Service/" />
          </baseAddresses>
        </host>
      </service>

      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.SalesMIPublicationService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IPublicationDataProvider">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/SalesMIPublicationService/" />
          </baseAddresses>
        </host>
      </service>

      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.CodeBookingService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.ICodeBooking">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/CodeBookingService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="LargeMessageBehavior" name="WCFSrv.QuoteService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IQuote">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" behaviorConfiguration="" binding="mexHttpBinding"
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/QuoteService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.LcvRateService">
        <endpoint address="" behaviorConfiguration="QuoteEndpointBehaviour"
          binding="wsHttpBinding" contract="WCFSrv.ILcvRate">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" behaviorConfiguration="" binding="mexHttpBinding"
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/LcvRateService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="LargeMessageBehavior" name="WCFSrv.AlertsService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IAlerts">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" behaviorConfiguration="" binding="mexHttpBinding"
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/AlertsService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.PlacementService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IPlacement">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/PlacementService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.PublicationService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IPublication">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/PublicationService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.AccessService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IAccess">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/AccessService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.ServicesService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IServices">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/ServicesService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.RoadService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IRoadServices">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/RoadService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.AverageLoggerService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IAverageLogger" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/AverageLoggerService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.DriverCertificationService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IDriverCertification" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/DriverCertificationService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.ImscanService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IImscanServices" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/ImscanService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.NominationService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.INomination" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/NominationService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.UserRegistrationService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IUserRegistration" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/UserRegistrationService/" />
          </baseAddresses>
        </host>
      </service>
      <service name="WCFSrv.Service1">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/WCFSrv/Service1/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="LargeMessageBehavior" name="WCFSrv.CvAccessoryService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.ICvAccessory">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/CvAccessoryService/" />
          </baseAddresses>
        </host>
      </service>
      <service name="WCFSrv.PoolFleetManagementService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IPoolFleetManagementService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/PoolFleetManagementService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.ServiceFormsService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IServiceFormService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/ServiceFormsService/" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="WCFSrv.ServiceBehavior"
        name="WCFSrv.DriverSalesService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFSrv.IDriverSalesService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFSrv/DriverSalesService/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="QuoteEndpointBehaviour">
          <dataContractSerializer maxItemsInObjectGraph="655360" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="WCFSrv.ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />

        </behavior>
        <behavior name="LargeMessageBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />

        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="MotorServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildMotord"
          maxBufferSize="655366" maxBufferPoolSize="524288" maxReceivedMessageSize="655366"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IDriverSalesService" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            bypassProxyOnLocal="false" transactionFlow="true" hostNameComparisonMode="StrongWildMotord"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
            allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession Placemented="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://172.22.191.44/MotorService/MotorService.asmx" binding="basicHttpBinding" bindingConfiguration="MotorServiceSoap" contract="Motor.MotorServiceSoap" name="MotorServiceSoap"/>
      <endpoint address="http://iisdbhxv02.prod.ltsbafd.net//CONNECT/LIVECONTRACTS/DRIVERSALES/DriverSalesService.svc"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDriverSalesService"
          contract="DriverSalesSrv.IDriverSalesService" name="WSHttpBinding_IDriverSalesService" />
    </client>
  </system.serviceModel>

  <applicationSettings>
    <Temp.Global.Diagnostics.Properties.Settings>
      <setting name="Folder" serializeAs="String">
        <value>C:\WebServices\WebServiceUsageLogs</value>
      </setting>
    </Temp.Global.Diagnostics.Properties.Settings>
  </applicationSettings>

  <startup>
    <supportedRuntime version="v4.0" sku=""NETFramework,Version=v4.0"/>
  </startup>
</configuration>

0 个答案:

没有答案