【问题标题】:publishing web service on 3 different IIS gets different result,Metadata publishing for this service is currently disabled在 3 个不同的 IIS 上发布 Web 服务得到不同的结果,该服务的元数据发布当前被禁用
【发布时间】:2020-08-24 04:43:34
【问题描述】:

我正在编写一个网络服务。当我在 Server1 (Windows 2012 With IIS 8) 上发布 Web 服务时,它工作正常,但如果我在 Server2 (Windows 2012 With IIS 8) 上发布,则会出现以下错误

此服务的元数据发布当前已禁用。

我在 Server3 上测试过(Windows 2019 With IIS 10),我得到了上述错误

似乎是 IIS 设置,因为在 server1 中它工作正常。

这是服务的 web.Config

   <?xml version="1.0"?>
 <configuration>

  <connectionStrings>

<add name="ECartContext" connectionString="metadata=res://*/ECartModel.csdl|res://*/ECartModel.ssdl|res://*/ECartModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=databaseServer;initial catalog=ECart;integrated security=True;Connection Timeout=30;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

</connectionStrings>

  <system.web>

 <compilation debug="true" targetFramework="4.0" /> 

</system.web>

<system.serviceModel>

<behaviors>

  <serviceBehaviors>

    <behavior  name="ManagementServiceBehaviour"> 
    
      <serviceMetadata httpGetEnabled="true"/>         

      <serviceDebug includeExceptionDetailInFaults="true"/>

      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     
    </behavior>       

    </serviceBehaviors> 
 
  <endpointBehaviors>

    <behavior>

      <dataContractSerializer  maxItemsInObjectGraph="2147483646" />

    </behavior> 
   
  </endpointBehaviors>

</behaviors>  

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

<bindings> 
 
  <basicHttpBinding>            
    
 <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" >
     
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

    </binding>

  </basicHttpBinding>   
   
</bindings> 

</system.serviceModel>

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="2147483648" />
  </requestFiltering>
</security>
</system.webServer>

<system.diagnostics>
<sources>
  <source name="System.ServiceModel"
             switchValue="Information, ActivityTracing"
             propagateActivity="true">
    <listeners>
      <add name="traceListener"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData= "c:\log\Traces.svclog" />
    </listeners>
  </source>
</sources>
</system.diagnostics>
 </configuration>

使用此配置,服务仅适用于 Server1,不适用于 Server2 和 Server3

如何检查问题?

【问题讨论】:

  • 能否提供一些关于该服务的配置信息?我认为这是由配置引起的。

标签: visual-studio web-services wcf iis


【解决方案1】:

您需要在服务模型中添加端点:

    <services>
        <service name="WcfService2.Service1" behaviorConfiguration="ManagementServiceBehaviour">
            <endpoint address="" contract="WcfService2.IService1" binding="basicHttpBinding"></endpoint>
        </service>
    </services>

我怀疑您在 server1 中有端点,但在 server2 和 server3 中没有端点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    相关资源
    最近更新 更多