Visual studio 在3个不同的IIS上发布web服务会得到不同的结果,此服务的元数据发布当前已禁用
我正在编写一个web服务。当我在Server1(使用IIS 8的Windows 2012)上发布web服务时,它可以正常工作,但如果我在Server2(使用IIS 8的Windows 2012)上发布web服务,则会出现以下错误 此服务的元数据发布当前已禁用 我在Server3(Windows 2019和IIS 10)上进行了测试,我发现了上述错误 看起来可能是IIS设置,因为在server1中它工作正常 这是服务的web.ConfigVisual studio 在3个不同的IIS上发布web服务会得到不同的结果,此服务的元数据发布当前已禁用,visual-studio,web-services,wcf,iis,Visual Studio,Web Services,Wcf,Iis,我正在编写一个web服务。当我在Server1(使用IIS 8的Windows 2012)上发布web服务时,它可以正常工作,但如果我在Server2(使用IIS 8的Windows 2012)上发布web服务,则会出现以下错误 此服务的元数据发布当前已禁用 我在Server3(Windows 2019和IIS 10)上进行了测试,我发现了上述错误 看起来可能是IIS设置,因为在server1中它工作正常 这是服务的web.Config <?xml version="1.0
<?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="data source=databaseServer;initial catalog=ECart;integrated security=True;Connection Timeout=30;multipleactiveresultsets=True;App=EntityFramework"" 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>
使用此配置,服务仅在服务器1上工作,而不是在服务器2和服务器3上工作
如何检查问题?您需要在servicemodel中添加端点:
<services>
<service name="WcfService2.Service1" behaviorConfiguration="ManagementServiceBehaviour">
<endpoint address="" contract="WcfService2.IService1" binding="basicHttpBinding"></endpoint>
</service>
</services>
我怀疑您在server1中有一个端点,但在serve2和server3中没有端点。您能提供一些有关该服务的配置信息吗?我认为这是由配置造成的。