Generally when you are developing SharePoint Provider hosted apps you can simply user SharePoint Online version to do testing and development.
But when it comes to actual deployment you may need it to deploy as SharePoint on premises solution.
You can do it by simply adding few additional configuration sections to web.config.
This is the default web.config you will have when you are working with O365, SharePoint Online Apps.
If you want to convert the same application to host in your premises as a provider hosted application. You just need few entries in your web config.
You need to specify Authorization and SSL certificate communication settings. After that you can configure your environment to host the application as High Trust SharePoint Application.
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
<appSettings>
<!-- Following values are critical to communicate app with shrepoint server -->
<add key="ClientId" value="21da123c-b1c9-4d54-9cb1-ee36b5f91304" />
<add key="ClientSigningCertificatePath" value="C:\inetpub\wwwroot\Certificates\sample.pfx" />
<add key="ClientSigningCertificatePassword" value="password" />
<add key="IssuerId" value="d250d0bc-d44e-4d8b-9e36-567817943628" />
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<!--Used by app for SharePoint-->
<binding name="secureBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpBinding" scheme="https" bindingConfiguration="secureBinding" />
</protocolMapping>
</system.serviceModel>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
Comments