Home > Enterprise >  Meta data is exposed and landing page of WCF service is shown, even with httpHelpPageEnabled="f
Meta data is exposed and landing page of WCF service is shown, even with httpHelpPageEnabled="f

Time:02-11

I need to deploy a WCF service. So I changed my web.config

To prevent that somebody calls:

svcutil.exe http://anysite.de/MyJobServer/MyJob.Service.svc/mex

I have this entry

<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />

To prevent that a start page with the text: "You have created a service..." so I changed the web.config and added:

httpHelpPageEnabled="false" 

But I can still call svcutil and it creates a service.cs and the starting web page is still shown.

This is the complete web.config system.serviceModel section.

<system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
        <service name="MyJob.Service"
                 behaviorConfiguration="behaviorDeployed">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfiguration" contract="MyJob.IService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:8733/Design_Time_Addresses/MyJobService/Service1/" />
                </baseAddresses>
            </host>
        </service>
    </services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="behaviorDeployed">
                <!-- To avoid disclosing metadata information, 
                     set the values below to false before deployment -->
                <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
                <!-- To receive exception details in faults for debugging purposes, 
                     set the value below to true.  Set to false before deployment 
                     to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false" httpHelpPageEnabled="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>

    <bindings>
        <basicHttpBinding>
            <binding name="basicHttpBindingConfiguration"
                     openTimeout="00:01:00" receiveTimeout="00:01:00"
                     maxBufferSize="1048576" maxReceivedMessageSize="1048576" maxBufferPoolSize="1048576" >
                <!-- Using HTTPS, set security mode="Transport" -->
                <!-- Using HTTP, set security mode="None" -->
                <security mode="Transport">
                    <transport clientCredentialType="None"/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
</system.serviceModel>

CodePudding user response:

Need to modify the configuration file App.config in service.cs

CodePudding user response:

The problem ist the mex binding.

The wsdl data can't be queried by this setting shown in the question.. The problem is that there is another endpoint: The mex endpoint. This also shows the meta data and it's own landing page.

I disabled the endpoint

<!-- 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
-->

And now I get a neutral landing page that this page doesn't provide any meta data.

  • Related