Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello Techie,

I am facing issue in WCF Service hosting in IIS.

I have used basicHttpBinding where i have mentioned all Service, Binding and Behavior.

While i used to go for IIS 7.0 hosting then i am facing issue of Metadata while i have kept the configuration as

< servicemetadata httpgetenabled="True" policyversion="Policy15" />

If i am exposing end point under Client tag in web.config then i am able to see metadata but when i expose the endpoint in Service tag in Web.config then i am facing metedata disclose issue.

Somewhere i have read that in Windows IIS Hosting, it does not expose the metadata of WCF service. many people has shown the example to set metadata in code but that is under self hosting.

Can anyone help me out that how can i expose the metadata in IIS Hosting with endpoint in Service tag of web.config.

Here is my web.config

XML
<configuration>
  <system.web>
    <compilation debug="true" targetframework="4.0" />
  </system.web>
  <system.servicemodel>
    <!--Code Added here for basicHttpBinding-->

    <bindings>
      <basichttpbinding>
        <binding name="BasicHttpBinding_IService" sendtimeout="00:05:00">
          <!--<security mode="None">
            --><!--<transport clientcredentialtype="Windows"></transport>--> <!--
          </security>-->
        </binding>
      </basichttpbinding>
    </bindings>
    <services>
      <service name="IService" behaviorconfiguration="IService1_Behavior">
        <!--<host>
          <baseAddresses>
            <add baseaddress="http://localhost/basicHttpService/service.svc" />
          </baseAddresses>
        </host>-->
        <endpoint binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IService" contract="IService"
          name="BasicHttpBinding_IService" >
          <!--<identity>
            <dns value="localhost" />
          </identity>-->
        </endpoint>

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

      </endpoint></service>
    </services>
    <!--<client>
      <endpoint address="http://localhost/basicHttpService/service.svc" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IService" contract="IService"
          name="BasicHttpBinding_IService" />
    </endpoint></client>-->


    <!--Code finished here for basicHttpBinding-->
    <behaviors>
      <endpointbehaviors>
        <!--<behavior name="IService_Behavior">
          <clientvia />
         
        </behavior>-->
        <behavior></behavior>
      </endpointbehaviors>
      <servicebehaviors>
        <behavior name="IService1_Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <servicemetadata httpgetenabled="True" policyversion="Policy15" />
         
          <!-- 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" httpshelppageenabled="True" />
          <!--<servicethrottling maxconcurrentcalls="10" maxconcurrentinstances="10" maxconcurrentsessions="10" />-->
        </behavior>
      </servicebehaviors>
    </behaviors>
    <servicehostingenvironment multiplesitebindingsenabled="true" />
  </system.servicemodel>
  <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directorybrowse enabled="false" />
  </system.webserver>
</configuration>
Posted
Updated 30-Jul-15 6:49am
v4
Comments
Member 11873526 10-Aug-15 2:48am    
Still i am waiting for an answer. its strange that now one is using WCF. oh my god. where are experts of WCF. people are writing blog but they nave not seen this question yet. how it can be possible.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900