locked
Cannot obtain Metadata from http wcf RRS feed

  • Question

  • Hi to all,

    I created one WCF Application in .net Frame work 3.5. It's working nicely in Local host But If I host in server It's Not working. When I try to get the meta data by using svcutil.exe it's showing error as

    C:\Program Files\Microsoft Visual Studio 9.0\VC>svcutil.exe http://115.108.5.207
    /TestWCF/Service1.svc?wsdl
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Attempting to download metadata from 'http://115.108.5.207/TestWCF/Service1.svc?
    wsdl' using WS-Metadata Exchange or DISCO.
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Error: Cannot obtain Metadata from http://115.108.5.207/TestWCF/Service1.svc?wsd
    l

    If this is a Windows (R) Communication Foundation service to which you have acce
    ss, please check that you have enabled metadata publishing at the specified addr
    ess.  For help enabling metadata publishing, please refer to the MSDN documentat
    ion at http://go.microsoft.com/fwlink/?LinkId=65455.


    WS-Metadata Exchange Error
        URI: http://115.108.5.207/TestWCF/Service1.svc?wsdl

        Metadata contains a reference that cannot be resolved: 'http://115.108.5.207
    /TestWCF/Service1.svc?wsdl'.

        <?xml version="1.0" encoding="utf-16"?><Fault xmlns="http://www.w3.org/2003/
    05/soap-envelope"><Code><Value>Sender</Value><Subcode><Value xmlns:a="http://sch
    emas.xmlsoap.org/ws/2005/02/sc">a:BadContextToken</Value></Subcode></Code><Reaso
    n><Text xml:lang="en-US">The message could not be processed. This is most likely
     because the action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get' is inco
    rrect or because the message contains an invalid or expired security context tok
    en or because there is a mismatch between bindings. The security context token w
    ould be invalid if the service aborted the channel due to inactivity. To prevent
     the service from aborting idle sessions prematurely increase the Receive timeou
    t on the service endpoint's binding.</Text></Reason></Fault>


    Can any one help me...

    Thanks in advance

    Regards,

    P.Ponkarthik
    Monday, January 4, 2010 12:04 PM

Answers

All replies

  • My configuration is like this


    <configuration>
    	<configSections>
    		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
    					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    				</sectionGroup>
    			</sectionGroup>
    		</sectionGroup>
    	</configSections>
    	<appSettings/>
    	<connectionStrings/>
    	<system.web>
    		<!--
                Set compilation debug="true" to insert debugging 
                symbols into the compiled page. Because this 
                affects performance, set this value to true only 
                during development.
            -->
    		<compilation debug="true">
    			<assemblies>
    				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			</assemblies>
    		</compilation>
    		<!--
                The <authentication> section enables configuration 
                of the security authentication mode used by 
                ASP.NET to identify an incoming user. 
            -->
    		<authentication mode="Windows"/>
    		<!--
                The <customErrors> section enables configuration 
                of what to do if/when an unhandled error occurs 
                during the execution of a request. Specifically, 
                it enables developers to configure html error pages 
                to be displayed in place of a error stack trace.
    
            <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
    		<pages>
    			<controls>
    				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			</controls>
    		</pages>
    		<httpHandlers>
    			<remove verb="*" path="*.asmx"/>
    			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    		</httpHandlers>
    		<httpModules>
    			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    		</httpModules>
    	</system.web>
    	<system.codedom>
    		<compilers>
    			<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    				<providerOption name="CompilerVersion" value="v3.5"/>
    				<providerOption name="WarnAsError" value="false"/>
    			</compiler>
    		</compilers>
    	</system.codedom>
    	<system.web.extensions>
    		<scripting>
    			<webServices>
    				<!--
                  Uncomment this section to enable the authentication service. Include 
                  requireSSL="true" if appropriate.
    
              <authenticationService enabled="true" requireSSL = "true|false"/>
              -->
    				<!--
                  Uncomment these lines to enable the profile service, and to choose the 
                  profile properties that can be retrieved and modified in ASP.NET AJAX 
                  applications.
    
              <profileService enabled="true"
                              readAccessProperties="propertyname1,propertyname2"
                              writeAccessProperties="propertyname1,propertyname2" />
              -->
    				<!--
                  Uncomment this section to enable the role service.
    
              <roleService enabled="true"/>
              -->
    			</webServices>
    			<!--
            <scriptResourceHandler enableCompression="true" enableCaching="true" />
            -->
    		</scripting>
    	</system.web.extensions>
    	<!--
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
    	<system.webServer>
    		<validation validateIntegratedModeConfiguration="false"/>
    		<modules>
    			<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    		</modules>
    		<handlers>
    			<remove name="WebServiceHandlerFactory-Integrated"/>
    			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    			<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    		</handlers>
    	</system.webServer>
    	<system.serviceModel>
    		<services>
    			<service name="TestWcf.Service1" behaviorConfiguration="TestWcf.Service1Behavior">
    				<!-- Service Endpoints -->
    				<endpoint address="" binding="wsHttpBinding" contract="TestWcf.IService1">
    					<!-- 
                  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.
              -->
    					<identity>
    						<dns value="localhost"/>
    					</identity>
    				</endpoint>
    				<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    			</service>
    		</services>
    		<behaviors>
    			<serviceBehaviors>
    				<behavior name="TestWcf.Service1Behavior">
    					<!-- 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>
    		</behaviors>
    	</system.serviceModel>
    </configuration>

    Thanks


    Monday, January 4, 2010 12:08 PM
  • Hi,
    you need to increase the nametable count
    have a look at this link
    http://msdn.microsoft.com/en-us/library/aa347733.aspx
    Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
    • Marked as answer by Riquel_Dong Monday, January 11, 2010 2:03 AM
    Monday, January 4, 2010 12:25 PM
  • Hi Ponkarthik,

    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.

    Please remove the following tag in configuration file. Whether you can view the metadata in web browser(IE, FireFox, etc).

                      <identity>
                            <dns value="localhost"/>
                        </identity>
    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, January 6, 2010 5:11 AM