我创建了工作流程服务,并使用installutil.exe安装了它。
但是即使HTTPGetEnabled设置为true,我也无法访问'MEX'端点。总是出现错误“此服务的元数据发布当前已禁用。”
您能帮我解决这个问题。
下面是我的App.Config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name ="MyBehaviour">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="GenerateResult.GenerateResult" behaviorConfiguration="MyBehaviour">
<endpoint address="http://localhost:5050/GetResultService" binding="basicHttpBinding"
bindingConfiguration="" contract="GenerateResult.IGenerateResult" />
<endpoint address="http://localhost:5050/GetResultService/mex"
binding="mexHttpBinding"
bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
尽管我们已经设置了httpGetEnabled
属性,但是我们需要设置HTTP基址来启用serviceMetadata
属性。请参考下面的代码段。
<system.serviceModel>
<services>
<service name="ConsoleApp3.TestService" behaviorConfiguration="mybeh">
<endpoint address="myservice" binding="basicHttpBinding" contract="ConsoleApp3.ITestService" bindingConfiguration=""></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" bindingConfiguration=""></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:21011/"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="mybeh">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
随时让我知道问题是否仍然存在。