Remote Event Receiver implementation for Sharepoint Add-In (Provider hosted App) - Giving Error

I am trying to create provider hosted MVC App by enabling Remote Event Receiver. When I try to deploy the app it is getting deployed but when I click Trust IT button after some time I am getting error message and also the app is not getting installed.

      CorrelationId: 29ca572c-d5df-49cb-b46a-370d73277982
        ErrorDetail: The remote event receiver callout failed.
        ErrorType: Transient
        ErrorTypeName: Intermittent
        ExceptionMessage: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'.
        Source: Common
        SourceName: Common App Deployment

In the client IIS server web site has Widows authentication enabled and the service folder got enabled with Anonymous authentication.

And in the web.config file I have binding details as

<binding name="SPFilesAccessServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>

I would like to know what I am missing in setting the environment.

SharePoint 2013 server installed in server 2012 [on premises]

MVC web application hosted in windows 8 IIS 8

September 2nd, 2015 8:06am

Hi,

In most of the case, the remote web of Provider hosted app will use some sort of authentication to prevent anoymous access.

If there is no credential configured to be used for client authentication, then the default clientCredentialType of basicHttpBinding is None. Obviously, when the client, here it is SharePoint, calls the service, it doesnt provide any credential. So it cannot pass the Windows authentication.

I suggest you can enable both anoymous and windows authentication in  IIS and configure the anoymous only on the remote event receiver service in web.config like below:

<configuration>
  <location path="AppEventReceiver.svc">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="14000" />
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>
......
</configuration>

Here is a detailed article for your reference:

Deploying a Remote Event Receiver in a Provider-Hosted App

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 12:29am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics