简体   繁体   English

WCF错误:此项服务的元数据发布当前被禁用

[英]WCF Error: Metadata publishing for this service is currently disabled

I want to publish a Webservice with basicHttpBinding configuration. 我想发布一个带有basicHttpBinding配置的Web服务。 I am using a basicHttpBinding configuration to increase the default message size of 65536 bytes. 我正在使用basicHttpBinding配置来增加默认消息大小65536字节。 The problem I am having is that when I use the web.config settings as shown below, I am getting an error: 我遇到的问题是,当我使用如下所示的web.config设置时,出现错误:

Metadata publishing for this service is currently disabled. 当前禁用了此服务的元数据发布。

My Main goal is to be able to increase the default message size and able to save binary file in database, therefore any other config is welcome, however I was trying to keep it as simple as possible to avoid further issues. 我的主要目标是能够增加默认消息大小并能够将二进制文件保存在数据库中,因此欢迎使用其他任何配置,但是我试图将其保持尽可能简单以避免出现更多问题。

Can you please spot what is wrong with my configuration? 您能找出我的配置有什么问题吗? Service.config code is below.. Service.config代码如下。

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpEndpointBinding" closeTimeout="01:01:00"
          openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
          messageEncoding="Mtom" textEncoding="utf-8" transferMode="StreamedRequest"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
            maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
     <services>
        <service name="WITSService.WITSService"  behaviorConfiguration="DragDrop.Service.ServiceBehavior" >
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding" contract="DragDrop.Service.IService">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
    <!--<services>
      <service name="WITSService.WITSService">
        <endpoint address="" binding="basicHttpBinding" contract="WITSService.WITSService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>-->

    <behaviors>
      <serviceBehaviors>
        <behavior name="DragDrop.Service.ServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="500000000" />
      </requestFiltering>
    </security>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

Put this configuration in your web.config. 将此配置放在您的web.config中。

<?xml version="1.0"?>
<configuration>
  <system.web>
    <httpRuntime executionTimeout="4800" maxRequestLength="2097150"/>
    <compilation debug="true"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding/>
      <customBinding>
        <binding name="LargeSilverlight" closeTimeout="00:21:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:50:00">
          <textMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
          </textMessageEncoding>
          <httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
        </binding>
      </customBinding>
    </bindings>
    <client/>
    <!--SERVICE-->
    <services>
      <service name="WITSService.WITSService" behaviorConfiguration="SilverlightWCFLargeDataApplication">
        <endpoint address="" binding="customBinding" bindingConfiguration="LargeSilverlight" behaviorConfiguration="SilverlightWCFLargeDataApplication" contract="DragDrop.Service.IService"/>
      </service>
    </services>
    <!--BEHAVIOR-->
    <behaviors>
      <serviceBehaviors>
        <behavior name="SilverlightWCFLargeDataApplication">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="SilverlightWCFLargeDataApplication">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="500000000"/>
      </requestFiltering>
    </security>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM