none
The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: RRS feed

  • Question

  • i have a wcf service my web config file is like this

    <?xml version="1.0"?>
    <configuration>
        <appSettings>
            <add key="aspnet:MaxHttpCollectionKeys" value="10000" />
            <add key="CrystalImageCleaner-AutoStart" value="true" />
            <add key="CrystalImageCleaner-Sleep" value="60000" />
            <add key="CrystalImageCleaner-Age" value="120000" />
        </appSettings>
        <system.web>
            <httpRuntime maxRequestLength="2097151" useFullyQualifiedRedirectUrl="true" executionTimeout="14400"   />

            <compilation debug="true" targetFramework="4.0">
                <assemblies>
                    <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
                    <!--<add assembly="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=B32731D11CE58905"/>-->
                    <add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
                    <add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
                    <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
                    <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
                    <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
                    <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
                </assemblies>
            </compilation>
            <httpHandlers>
                <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            </httpHandlers>
        </system.web>

        <system.serviceModel>
            <!--<behaviors>
          <endpointBehaviors>
            <behavior name="SerializerBehavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
          </endpointBehaviors>
        </behaviors>-->
        

          
            <bindings>
                <wsHttpBinding>
                    <binding name="WSHttpBinding_IIntegratedTaxSystemService" closeTimeout="00:02:00"
                        openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:30:00"
                        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                        messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"
                        allowCookies="false">
                        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                        <reliableSession ordered="true" inactivityTimeout="12:00:00"
                            enabled="true" />
                        <security mode="Message">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                                algorithmSuite="Default" />
                        </security>
                    </binding>
                </wsHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://localhost:4795/IntegratedTaxSystemService.svc"
                    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IIntegratedTaxSystemService"
                    contract="IntegratedTaxSystemServiceReference.IIntegratedTaxSystemService"
                    name="WSHttpBinding_IIntegratedTaxSystemService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
            </client>

        </system.serviceModel>
        <system.webServer>
            <handlers>
                <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
            </handlers>
            <validation validateIntegratedModeConfiguration="false"/>
        </system.webServer>
    </configuration>

    When i update my service reference there is error is popup

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    There was an error downloading 'http://localhost:4795/IntegratedTaxSystemService.svc/mex'.

    The request failed with HTTP status 400: Bad Request.

    Metadata contains a reference that cannot be resolved: 'http://localhost:4795/IntegratedTaxSystemService.svc/mex'.

    Metadata contains a reference that cannot be resolved: 'http://localhost:4795/IntegratedTaxSystemService.svc/mex'.
    ---------------------------
    OK   
    ---------------------------

    when i open my service i found the following error

    Service

    The service encountered an error.

    An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/:IIntegratedTaxSystemService ----> System.InvalidOperationException: DataContract for type 'IntegratedTaxSystemService.DataTransferObjects.DocumentsDto' cannot be added to DataContractSet since type 'IntegratedTaxSystemService.DataTransferObjects.DocumentDto' with the same data contract name 'Documents' in namespace 'http://www.pcs.com.np/types/' is already present and the contracts are not equivalent. at System.Runtime.Serialization.DataContractSet.InternalAdd(XmlQualifiedName name, DataContract dataContract) at System.Runtime.Serialization.DataContractSet.AddClassDataContract(ClassDataContract classDataContract) at System.Runtime.Serialization.DataContractSet.InternalAdd(XmlQualifiedName name, DataContract dataContract) at System.Runtime.Serialization.DataContractSet.Add(Type type) at System.Runtime.Serialization.XsdDataContractExporter.Export(Type type) at System.ServiceModel.Description.MessageContractExporter.ExportType(Type type, String partName, String operationName, XmlSchemaType& xsdType) at System.ServiceModel.Description.DataContractSerializerMessageContractExporter.ExportBody(Int32 messageIndex, Object state) at System.ServiceModel.Description.MessageContractExporter.ExportMessage(Int32 messageIndex, Object state) at System.ServiceModel.Description.MessageContractExporter.ExportMessageContract() at System.ServiceModel.Description.DataContractSerializerOperationBehavior.System.ServiceModel.Description.IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext contractContext) at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension) --- End of inner ExceptionDetail stack trace --- at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata() at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized() at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension) at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData() at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage) at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest) at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.Get(Message message) at SyncInvokeGet(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

    what is wrong here ?


    Tribhuwan kushwaha

    Sunday, May 4, 2014 11:22 AM

Answers

  • Hi,

    Fisrt please try to check that your service has adding the following in the config file:

    serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true" />
    ....................

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

    Then please try to enable the wcf tracing to get more information.
    #How to enable wcf tracing:
    http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx .

    It will be better if you can post your service config file and code here, then I want to have a test in my side.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 5, 2014 7:41 AM
    Moderator

All replies

  • Hi,

    Fisrt please try to check that your service has adding the following in the config file:

    serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true" />
    ....................

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

    Then please try to enable the wcf tracing to get more information.
    #How to enable wcf tracing:
    http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx .

    It will be better if you can post your service config file and code here, then I want to have a test in my side.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 5, 2014 7:41 AM
    Moderator
  • Your answer resolved issue I was facing. 

    I have just updated below code

    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpsGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="True" />
      </behavior>
    </serviceBehaviors>



    Thursday, March 30, 2017 7:21 AM