Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint

Converting O365 / SharePoint App to SharePoint 2013 on Premises Solution

0.00/5 (No votes)
13 Mar 2017CPOL 3.4K  
How to convert O365/SharePoint app to SharePoint 2013 on premises solution

Generally, when you are developing SharePoint Provider hosted apps, you can simply use the 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.

image

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.

image

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.

XML
<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 Sharepoint 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>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)