6

ok, my file have this structure.

<system.serviceModel>
    <services>
        <service name="ManyaWCF.ServiceManya" behaviorConfiguration="ServiceBehaviour">
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address="" binding="webHttpBinding" contract="ManyaWCF.IServiceManya" behaviorConfiguration="web">
                <!-- 
             Upon deployment, the following identity element should be removed or replaced to reflect the 
             identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
             automatically.
         -->
            </endpoint>
        </service>

    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceBehaviour">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true" />
                <!-- 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" />
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="web">
                <webHttp />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

i got the same web.config in other wcf and worked like a champ, ofc with different folders and files. my folder structure is the following.

enter image description here

When i try to play it i get this,

 Service

 This is a Windows © Communication Foundation.

 The metadata publishing for this service is currently disabled.

 If you access the service, you can enable metadata publishing by completing the following steps to modify the configuration file or web application:

 1. Create the following service behavior configuration, or add the item to a configuration <serviceMetadata> existing service behavior:

<behaviors>
<serviceBehaviors>
    <behavior name="MyServiceTypeBehaviors">
        httpGetEnabled="true" <serviceMetadata />
    </ Behavior>
</ ServiceBehaviors>
</ Behaviors>
 2. Add the behavior configuration to the service:

  name="MyNamespace.MyServiceType" <service behaviorConfiguration="MyServiceTypeBehaviors">
  Note: The service name must match the name of the configuration for the service implementation.

 3. Add the following to end service configuration:

 binding="mexHttpBinding" contract="IMetadataExchange" <endpoint address="mex" />
 Note: the service must have an http base address to add this.

 Here is an example of a service configuration file with metadata publishing enabled:

 <configuration>
 <system.serviceModel>

    <services>
        <! - Note: the service name must match the name of the configuration for the service implementation. ->
        name="MyNamespace.MyServiceType" <service behaviorConfiguration="MyServiceTypeBehaviors">
            <! - Add the following end. ->
            <! - Note: the service must have an http base address to add this. ->
            binding="mexHttpBinding" contract="IMetadataExchange" <endpoint address="mex" />
        </ Service>
    </ Services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="MyServiceTypeBehaviors">
                <! - Add the following item to the service behavior configuration. ->
                httpGetEnabled="true" <serviceMetadata />
            </ Behavior>
        </ ServiceBehaviors>
    </ Behaviors>

 </ System.serviceModel>
 </ Configuration>

  For more information about publishing metadata, see the following documentation: http://go.microsoft.com/fwlink/?LinkId=65455 (may be in English).

so, i only did 1 wcf and worked fine with same web.conif. My luck of exp and knowledge about this is killing me. Any clue?

Thx in advance.

pata
  • 959
  • 2
  • 18
  • 35

2 Answers2

4

As far as I know, you only need the endpoint with the mexHttpBinding if you want to expose the WSDL to clients. Visual Studio (or wcfutil.exe) needs the WSDL description to create the webservice client classes.

After these webservice client classes are created, you shouldn't need to expose the WSDL anymore.

UPDATE: The <service> element in your configuration file should look like this:

<service name="ManyaWCF.ServiceManya" behaviorConfiguration="ServiceBehaviour">
    <endpoint address="" binding="webHttpBinding" 
        contract="ManyaWCF.IServiceManya" behaviorConfiguration="web" />

    <endpoint address="mex" binding="mexHttpBinding" 
        contract="IMetadataExchange" />
</service>
Elian Ebbing
  • 18,779
  • 5
  • 48
  • 56
  • hmm. i can see mexhttpbinding on code. I can´t see if there is something wrong or need to chance something – pata Jan 07 '12 at 00:07
  • @Guillermo - I don't see the mex endpoint enabled in your configuration file. Maybe the following article helps: http://blogs.msdn.com/b/brajens/archive/2007/04/26/accessing-description-metadata-wsdl-of-wcf-web-service.aspx – Elian Ebbing Jan 07 '12 at 00:14
  • isnt it this, ?? – pata Jan 07 '12 at 00:18
  • @Guillermo - No, that endpoint exposes the webservice itself, not the WSDL description that describes the webservice. – Elian Ebbing Jan 07 '12 at 00:21
  • ok, thx for the brief explanation. doubt, the link u provide me does the same im doing. i dont understand how to change my web.config. Is is possible if u can show me how should it be? thx – pata Jan 07 '12 at 00:29
  • @Guillermo - The configuration you showed in your question doesn't contain the mex endpoint. Can you update your question and show the current configuration? – Elian Ebbing Jan 07 '12 at 00:34
  • i change the services as ur update but still getting same web page when i try to play it. – pata Jan 07 '12 at 01:23
  • @Guillermo - Then I don't know what the problem is. – Elian Ebbing Jan 07 '12 at 02:21
  • if i put behaviorConfiguration="" its works, but with other wcf. With a old one i get the same error with same web.config just changing some names... cant understand this. – pata Jan 08 '12 at 00:07
-2
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
  </system.web>
  <appSettings>
    </appSettings>
  <connectionStrings>
    <add name="SQLConnect" connectionString="Your_Connection_String";User id=sa;Password=welcome3#"/>
  </connectionStrings>
  <system.serviceModel>
    <services>
      <service name="WCFRestService.RestServiceSvc" behaviorConfiguration="serviceBehavior">
        <endpoint address="" bindingConfiguration="secureHttpBinding" binding="webHttpBinding" contract="WCFRestService.IRestServiceSvc" behaviorConfiguration="web"></endpoint>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="serviceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <webHttpBinding>
        <binding name="secureHttpBinding"
          maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647"
          maxBufferSize="2147483647" transferMode="Streamed">       
        </binding>
      </webHttpBinding>
    </bindings>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <httpProtocol>
      <customHeaders>       
      </customHeaders>
    </httpProtocol>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>
    <directoryBrowse enabled="true" />
  </system.webServer>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="50000000"/>
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>
Mohan Kumar
  • 647
  • 7
  • 8
  • Your answer, although does provide a correct example, does not help answer the OP question. Would recommend providing more detail. – PseudoNinja Nov 27 '17 at 20:46