I want to store my session in session state service. I am following this site for setting up it.

But when I enable it, my site gives me 500 Internal Server Error. When I trace it I see below log:

  <Data Name="ContextId">{80000319-0000-5A00-B63F-84710C7967BB}</Data>
  <Data Name="ModuleName">IIS Web Core</Data>
  <Data Name="Notification">1</Data>
  <Data Name="HttpStatus">500</Data>
  <Data Name="HttpReason">Internal Server Error</Data>
  <Data Name="HttpSubStatus">19</Data>
  <Data Name="ErrorCode">2147942583</Data>
  <Data Name="ConfigExceptionInfo">\\?\C:\inetpub\wwwroot\wss\VirtualDirectories\demo.test80a73222a2-f9b6-4085-9f5b-509b8d04f213\web.config ( 680) :Cannot add duplicate collection entry of type &apos;add&apos; with unique key attribute &apos;name&apos; set to &apos;Session&apos;

I have enabled session state as follow:

<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" clientIDMode="AutoID" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">

And commented below line:

<!--<remove name="Session" /> -->

I have enabled third party authentication using Identity server, which adds below code in file:

<add name="SessionAuthentication" type="Microsoft.SharePoint.IdentityModel.SPSessionAuthenticationModule, Microsoft.SharePoint.IdentityModel, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

Nothing added except that. Can someone help me understand what is wrong?

  • whats written in the LOGS FOLDER?
    – samolpp2
    Commented Feb 3, 2017 at 8:48

1 Answer 1


It tells you in the message that you've added a duplicate key of 'Session'. Remove your 'Session' key that you've manually created. SharePoint adds one by default or when you've provisioned the Session State service (forget which).

  • updated question with information in web.config file Commented Feb 6, 2017 at 10:59
  • can you suggest which line is causing issue? Commented Feb 6, 2017 at 11:00
  • Post your entire web.config on OneDrive or a similar service. I'll just be making guesses looking at the one liners you've posted.
    – user6024
    Commented Feb 6, 2017 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.