vendredi 22 avril 2016

Set up SharePoint 2016 Extranet for your client/provider part 2, set up web.config and install FBA pack

Please see step 1 if you missed it on how to create membership database, create webApplication for your Extranet site and how to extend it :

1. Configure web.config

We will now tell SharePoint that membership provider and the role provider are stored into the database we create in the first step.

Locate the file machine.config into C:\Windows\Microsoft.Net\Framework64\v4.0.30319\Config
save a copy of that file and edit the original one:

In the section "Connectionstrings"  add :

<add connectionString="Server=SP2016; Database=fba_extranet; Integrated Security=true" name="SQLConn" />

Replace "SP2016" and "fba_extranet" by your SQL server instance and the database name you create earlier:

Into "<membership><providers>"  add the following lines, replace "SQL_Membership" by the membership provider name you chose earlier when we have extended the webApplication. You can see that you can change some parameters (password length, max invalid password attempts before account will be locked etc..):

  <add name="SQL_Membership"  Type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"  ConnectionStringName="SQLConn"  EnablePasswordRetrieval="false"  enablePasswordReset="true"  requiresQuestionAndAnswer="false"  applicationName="/"  requiresUniqueEmail="true"  passwordFormat="Hashed"  maxInvalidPasswordAttempts="20"  minRequiredPasswordLength="7"  minRequiredNonalphanumericCharacters="1"  passwordAttemptWindow="10"  passwordStrengthRegularExpression="" />

Into "<roleManager><providers>"  add the following lines, replace "SQL_Role" by the membership provider name:

<add name="SQL_Role" connectionStringName="SQLConn" applicationName="/"
 type="System.Web.Security.SqlRoleProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Save the file (if you have problem saving the file open notepad with admin right).

2. Edit Security Token Service Application

Go to IIS manager, go into "SharePoint Web Services" right click on "SecurityTokenServiceApplication" and clic "Explore":


Modify web.config file add the membership and role like you did into machine.config file add the following line under <configuration>

<!-- Section to add -->
  <!-- Add membership provider here -->
   <roleManager enabled="true">
    <!-- Add role provider here -->
   <customErrors mode="RemoteOnly"/>
<!-- End Section to add -->

3. Install FBA Pack solution

We can now create our first site collection in the web application go to "Application Management => Create site collection"

Select the webApplication Extranet and create a team site for example

Download the zip from and extract the archive on the SharePoint 2016 server, add the solution thanks to powershell with the Add-SPSolution.

Navigate to the farm solutions management page and deploy the solution to your WebApplication:

5 commentaires :