2012-01-06 13 views
6

ठीक है, मेरी फ़ाइल में यह संरचना है।wcf web.config फ़ाइल

<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> 

मुझे अन्य wcf में वही web.config मिला और विभिन्न फ़ोल्डरों और फ़ाइलों के साथ एक चैंप, सीसीसी की तरह काम किया। मेरी फ़ोल्डर संरचना निम्नलिखित है।

enter image description here

जब मैं इसे खेलने के लिए मैं इस मिल की कोशिश,

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). 

हां, तो मैं केवल 1 WCF किया था और एक ही web.conif के साथ ठीक काम किया। इस बारे में विस्तार और ज्ञान की मेरी किस्मत मुझे मार रही है। कोई सुराग?

अग्रिम में Thx।

उत्तर

4

जहां तक ​​मुझे पता है, आपको केवल mexHttpBinding के साथ एंडपॉइंट की आवश्यकता है यदि आप ग्राहकों को डब्लूएसडीएल का पर्दाफाश करना चाहते हैं। Visual Studio (या wcfutil.exe) को webservice क्लाइंट क्लास बनाने के लिए WSDL विवरण की आवश्यकता है।

इन webservice क्लाइंट क्लास बनाए जाने के बाद, आपको अब डब्लूएसडीएल का पर्दाफाश करने की आवश्यकता नहीं है।

अद्यतन: अपने विन्यास फाइल में<service> तत्व इस तरह दिखना चाहिए:

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

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

हम्म। मैं कोड पर mexppbinding देख सकते हैं। मैं नहीं देख सकता कि क्या कुछ गड़बड़ है या कुछ मौका देने की आवश्यकता है –

+0

@Guillermo - मुझे आपकी कॉन्फ़िगरेशन फ़ाइल में मैक्स एंडपॉइंट सक्षम नहीं दिख रहा है। हो सकता है कि निम्न आलेख मदद करता है: http://blogs.msdn.com/b/brajens/archive/2007/04/26/accessing-description-metadata-wsdl-of-wcf-web-service.aspx –

+0

यह नहीं है, ?? –

-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> 
+0

आपका उत्तर, हालांकि एक सही उदाहरण प्रदान करता है, ओपी प्रश्न का उत्तर देने में मदद नहीं करता है। अधिक जानकारी प्रदान करने की सिफारिश करेंगे। – PseudoNinja