WCF配置设置问题,端点默认为mex

本文关键字:默认 mex 端点 配置 设置 问题 WCF | 更新日期: 2023-09-27 17:51:05

我正在尝试与wsHttpBinding建立我的服务。服务页面在firefox中加载得很好,但是当使用WCFTestClient发出请求时,会触发一个错误异常,因为它显然是出于某种原因试图访问mex EndPoint。如您所见,我甚至没有列出mex,下面是配置:

<system.serviceModel>    
    <services>
      <service name="WorkFlowManagement" behaviorConfiguration="WorkFlowManagementBehavior">
        <endpoint binding="wsHttpBinding" contract="IWorkflowManagement"
                  bindingConfiguration="WSHttpBinding_IWorkflowManagement"
                  name="WSHttpBinding_IWorkflowManagement"/>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IWorkflowManagement" maxBufferPoolSize="999965536"
                 maxReceivedMessageSize="999965536" messageEncoding="Text" textEncoding="utf-8">
          <readerQuotas maxArrayLength="999965536" maxBytesPerRead="999965536" maxDepth="999965536"
                        maxNameTableCharCount="999965536" maxStringContentLength="999965536"/>
          <security mode="None"/>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WorkFlowManagementBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <sqlWorkflowInstanceStore
            connectionString="my connection string"
           instanceEncodingOption="None" instanceCompletionAction="DeleteAll" instanceLockedExceptionAction="BasicRetry" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:02" />
          <workflowIdle timeToUnload="0"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add factory="SecAmerInc.STPCore.Services.WorkFlowManagment.WFServiceFactory"
             relativeAddress="./WorkFlowManagement.xamlx"
             service="WorkFlowManagement.xamlx"/>
      </serviceActivations>
    </serviceHostingEnvironment>
  </system.serviceModel>

然而,这是一个异常消息:

带有To的消息"http://localhost/SecAmerInc.STPCore.Services.WorkFlowManagement/WorkFlowManagement.xamlx/mex"由于AddressFilter不匹配,无法在接收端处理在EndpointDispatcher。检查发送方和接收方关注endpointaddress同意。

这是WCFTestClient的配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IWorkflowManagement" sendTimeout="00:05:00">
                    <security mode="None" />
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost/SecAmerInc.STPCore.Services.WorkFlowManagement/WorkFlowManagement.xamlx"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWorkflowManagement"
                contract="IWorkflowManagement" name="WSHttpBinding_IWorkflowManagement" />
        </client>
    </system.serviceModel>
</configuration>

WCF配置设置问题,端点默认为mex

MEX(元数据交换)端点将有关您的服务的元数据发送给调用者。该工具可能需要您的元数据来了解如何与您的服务进行通信。如果您想使用此工具进行测试,请定义您的MEX端点。