简体   繁体   中英

“There was no endpoint listening” - Configuration Mismatch Perhaps?

I get

"There was no endpoint listening at https://localhost/BassCoastServices/GeneralUtilityService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

when I call the GeneralUtilityService from the client side and

"There was no channel actively listening at ' https://laura-laptop/BassCoastServices/GeneralUtilityService.svc '. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening."

shows up when I debug w3wp.

Is there some sort of tool I can use that will make sure a client and server config file line up? If this is an easy fix, please see the below App and Web config files.

App.config

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="Username" value="sampleuser"/>
    <add key="Password" value="samplepassword"/>
    <add key="basePath" value="C:\Temp"/>
  </appSettings>

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <bindings>
      <wsHttpBinding>
        <binding name="standardBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" allowCookies="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
          <reliableSession ordered="true" inactivityTimeout="01:00:00" enabled="false"/>
          <security mode="TransportWithMessageCredential" >
            <transport clientCredentialType="Certificate" proxyCredentialType="None"  />
            <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ClientCertificateBehavior">
          <callbackDebug includeExceptionDetailInFaults="true"/>
          <clientCredentials>
            <clientCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
            </clientCertificate>
          </clientCredentials>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <client>

      <endpoint address="https://localhost/BassCoastServices/GeneralUtilityService.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="standardBinding" contract="Adapt.WCF.IGeneralUtilityService" name="IGeneralUtilityServiceEndPoint">
        <identity>
          <dns value="localhost"/>
        </identity>
      </endpoint>

    </client>
  </system.serviceModel>

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

Web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <appSettings>

    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
    <add key="DatabaseConnectionString" value="Data Source=(local)\SQL2014;Initial Catalog=XIVICProduction;User ID=sa;Password=sameplepassword;MultipleActiveResultSets=True"/>
    <add key="LogFilePath" value="C:\inetpub\wwwroot\Xivic\BassCoastServices\Log\Log.txt"/>
    <add key="AllowMissingExternalIDs" value="true"/>

    <!--No need to change-->
    <add key="LogFileTypeLevel" value="Error"/>
    <add key="SqlServerDateTimeStyle" value="103"/>
    <add key="DatabaseType" value="Sql"/>
    <add key="EnforceSecurityAtBusinessRulesLayer" value="false"/>
    <add key="DateComparisonInaccuracy" value="35000"/>
    <add key="CacheAccessItemsAtBusinessLayer" value="true"/>
    <add key="CacheRecordsAtDataLayer" value="true"/>
    <add key="SesionTimeout" value="1440"/>
  </appSettings>

  <system.serviceModel>

    <services>
      <!-- ENDPOINTS -->
      <service name="IGeneralUtilityServiceEndPoint" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="wsHttpBinding" contract="Adapt.WCF.IGeneralUtilityService" bindingConfiguration="wsHttpEndpointBinding"/>
      </service>

    </services>

    <!-- BEHAVIOURS -->
    <behaviors>
      <serviceBehaviors>
        <behavior name="UserNameBehaviour">
          <serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647" />
          <serviceDebug includeExceptionDetailInFaults="True" />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Adapt.WCF.Security.CustomUserNameValidator, Adapt.WCF" />
            <serviceCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
            </serviceCertificate>
          </serviceCredentials>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <!-- BINDINGS -->
    <bindings>

      <wsHttpBinding>
        <binding name="wsHttpEndpointBinding">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>

    </bindings>

  </system.serviceModel>

  <system.diagnostics>
        <sources>
            <source name="System.ServiceModel"
                    switchValue="Information, ActivityTracing"
                    propagateActivity="true">
                <listeners>
                    <add name="traceListener"
                        type="System.Diagnostics.XmlWriterTraceListener"
                        initializeData= "C:\inetpub\wwwroot\Xivic\BassCoastServices\Log\Traces.svclog" />
                </listeners>
            </source>
        </sources>
    </system.diagnostics>

  <!--startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
  </startup-->

</configuration>

Calling WCF

_Channel = GetProxy<IGeneralUtilityService>();
_Channel.BeginTransaction(transactionId);
_Channel.CommitTransaction(transactionId);

public static T GetProxy<T>()
{
    var channelFactory = new ChannelFactory<T>(string.Format("{0}EndPoint", typeof(T).Name));
    channelFactory.Credentials.UserName.UserName = ConfigurationSettings.AppSettings["Username"];
    channelFactory.Credentials.UserName.Password = ConfigurationSettings.AppSettings["Password"];
    var workflowProxy = channelFactory.CreateChannel();
    return workflowProxy;
}

Thanks in advance!

Update: I don't know what I did but now I'm getting

"Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost/BassCoastServices/GeneralUtilityService.svc . The client and service bindings may be mismatched."

Your problem is the way you create your channel factory. Some how it can not get the correct EndpointConfigurationName.

I'm not quite familiar on how to use only the EndpointConfigurationName as parameter in Channel Factory but you can try it this way:

var channelFactory = new ChannelFactory<T>("*", new EndpointAddress("https://localhost/BassCoastServices/GeneralUtilityService.svc"));

Well I don't know what the problem was but for anyone looking for a solution to this problem here are my web and app config files:

Web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>

    <!--Please configure-->
    <!--Laura Local-->
    <add key="DatabaseConnectionString" value="Data Source=(local)\SQL2014;Initial Catalog=XIVICProduction;User ID=sa;Password=samplepassword;MultipleActiveResultSets=True"/>

    <!--No need to change-->
    <add key="LogFilePath" value="C:\Temp\Log\log.txt" />
    <add key="LogFileTypeLevel" value="Information" />
    <add key="SqlServerDateTimeStyle" value="103" />
    <add key="DatabaseType" value="Sql" />
    <add key="EnforceSecurityAtBusinessRulesLayer" value="false" />
    <add key="DateComparisonInaccuracy" value="35000" />
    <add key="CacheAccessItemsAtBusinessLayer" value="true" />
    <add key="CacheRecordsAtDataLayer" value="true" />

    <!--Email Configuration-->
    <!--add key="EmailAlertHost" value=""[INSERT="" HOST="" ADDRESS=""]/>
    <add key="EmailAlertUsername" value=""[INSERT="" USERNAME=""]/>
    <add key="EmailAlertPassword" value=""[INSERT="" PASSWORD=""] />
    <add key="EmailAlertReplyToAddress" value=[INSERT REPLY TO ADDRESS] />
    <add key="EmailAlertToAddress" value=""/>
    <add key="EmailAlertCCAddress" value=""/>
    <add key="EmailAlertSubject" value="*WARNING* - A Fatal Error Occurred  @ {0} - *WARNING*"/>
    <add key="EmailAlertPriority" value="High"/-->

  </appSettings>

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

  <system.web>
    <compilation debug="true"/>
  </system.web>

  <system.serviceModel>

    <services>
      <!--AssetInventoryService-->
      <service name="Adapt.WCF.AssetInventory.AssetInventoryService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.AssetInventory.AssetInventoryService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--AssetValuationUtilityService-->
      <service name="Adapt.WCF.AssetValuation.AssetValuationUtilityService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.IAssetValuationUtilityService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--CodeGenerationService-->
      <service name="Adapt.WCF.CodeGeneration.CodeGenerationService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.CodeGeneration.CodeGenerationService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--CodeUtilityService-->
      <service name="Adapt.WCF.CodeGeneration.CodeUtilityService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.CodeGeneration.ICodeUtilityService" bindingConfiguration="UserNameBinding"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/CodeUtilityService.svc" />
          </baseAddresses>
        </host>
      </service>
      <!--DataSchemaService-->
      <service name="Adapt.WCF.DataSchema.DataSchemaService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.DataSchema.DataSchemaService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--DataTransactionService-->
      <service name="Adapt.WCF.DataTransaction.DataTransactionService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.DataTransaction.DataTransactionService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--GeneralUtilityService-->
      <service name="Adapt.WCF.GeneralUtilityService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.IGeneralUtilityService" bindingConfiguration="UserNameBinding"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/GeneralUtilityService.svc" />
          </baseAddresses>
        </host>
      </service>
      <!--SecurityService-->
      <service name="Adapt.WCF.Security.SecurityService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.Security.SecurityService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--SyncService-->
      <service name="Adapt.WCF.SyncService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.ISyncService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--SystemSetupService-->
      <service name="Adapt.WCF.SystemSetup.SystemSetupService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.SystemSetup.SystemSetupService" bindingConfiguration="UserNameBinding" />
      </service>
      <!--TaskManagementService-->
      <service name="Adapt.WCF.TaskManagement.TaskManagementService" behaviorConfiguration="UserNameBehaviour">
        <endpoint binding="customBinding" contract="Adapt.WCF.TaskManagement.TaskManagementService" bindingConfiguration="UserNameBinding" />
      </service>
    </services>

    <!-- BEHAVIOURS -->
    <behaviors>
      <serviceBehaviors>
        <behavior name="UserNameBehaviour">
          <serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647" />
          <serviceDebug includeExceptionDetailInFaults="True" />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Adapt.WCF.Security.CustomUserNameValidator, Adapt.WCF" />
            <serviceCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
            </serviceCertificate>
          </serviceCredentials>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <!-- BINDINGS -->
    <bindings>
      <customBinding>
        <binding name="UserNameBinding" closeTimeout="23:00:00" openTimeout="23:00:00" receiveTimeout="23:00:00" sendTimeout="23:00:00">
          <security authenticationMode="SecureConversation" requireSecurityContextCancellation="true">
            <secureConversationBootstrap authenticationMode="UserNameForSslNegotiated">
            </secureConversationBootstrap>
          </security>
          <textMessageEncoding>
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </textMessageEncoding>
          <httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>
  <!--<system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\temp\log\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>-->
</configuration>

App.config

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="Username" value="dspec"/>
    <add key="Password" value="samplepassword"/>
    <add key="BasePath" value="c:\FileDrop"/>
  </appSettings>

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <bindings>
      <wsHttpBinding>
        <binding name="standardBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" allowCookies="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
          <reliableSession ordered="true" inactivityTimeout="01:00:00" enabled="false"/>
          <security mode="Message">
            <transport clientCredentialType="Certificate" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
          </security>
        </binding>
      </wsHttpBinding>



    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ClientCertificateBehavior">
          <callbackDebug includeExceptionDetailInFaults="true"/>
          <clientCredentials>
            <serviceCertificate>
              <authentication certificateValidationMode="None"/>
            </serviceCertificate>
          </clientCredentials>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <client>

      <endpoint address="http://localhost/BassCoastServices/GeneralUtilityService.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="standardBinding" contract="Adapt.WCF.IGeneralUtilityService" name="IGeneralUtilityServiceEndPoint">
        <identity>
          <dns value="localhost"/>
        </identity>
      </endpoint>

    </client>
  </system.serviceModel>

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

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