locked
WCF service getting error in console after adding reference. RRS feed

  • Question

  • Hi All,

    I have develop web service and configured with SharePoint. I have added reference added in console application. I am created object and trying to access my method the getting below error.

    Kindly suggest.

    URL: https://testURL/_vti_bin/ReportDocumentService.svc

    Error: 

    An unhandled exception of type 'System.ServiceModel.Security.MessageSecurityException' occurred in mscorlib.dll

    Additional information: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM,Basic realm="testURL"'.

    Web.config file:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ReportDocumentService">
              <serviceMetadata httpsGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="ReportDocumentService">
              <callbackDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <bindings>
          <basicHttpBinding>
            <binding name="WindowsAuthenticationBinding"
                     maxBufferPoolSize="2147483647"
                     maxReceivedMessageSize="2147483647"
                     maxBufferSize="2147483647"
              >
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
              <readerQuotas maxDepth="64" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
            </binding>
          </basicHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="ReportDocumentService" name="ATC.WSS.ReportDocument.Webservice.Service1">
            <endpoint address="" binding="basicHttpBinding" contract="ATC.WSS.ReportDocument.Webservice.IReportDocumentService" bindingConfiguration="WindowsAuthenticationBinding" />
            <endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" bindingConfiguration="WindowsAuthenticationBinding" />
            <host>
              <baseAddresses>
                <add baseAddress="https://testURL/_vti_bin/ReportDocumentService.svc"/>
              </baseAddresses>
            </host>
          </service>
        </services>
      </system.serviceModel>
    </configuration>

    Thanks,

    Harish Patil

    Wednesday, July 15, 2020 12:40 PM

All replies