Category Archives: IIS

System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.

For one of our clients we are working with a claims based web application. This web application has a custom membership provider that is registered at the web application, central administration and security token service level.

When we navigate to the site everything works perfectly but when we try to login with valid credentials we would receive an error like below:

Server Error in ‘/’ Application.



Runtime Error Description: An application error occurred on the server. The current custom error

The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.]
   Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.ReadResponse(Message response) +1161205
   Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr) +73
   Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst) +36
   Microsoft.SharePoint.SPSecurityContext.SecurityTokenForContext(Uri context, Boolean bearerToken, SecurityToken onBehalfOf, SecurityToken actAs, SecurityToken delegateTo) +26405809
   Microsoft.SharePoint.SPSecurityContext.SecurityTokenForFormsAuthentication(Uri context, String membershipProviderName, String roleProviderName, String username, String password) +26406316
   Microsoft.SharePoint.IdentityModel.Pages.FormsSignInPage.GetSecurityToken(Login formsSignInControl) +188
   Microsoft.SharePoint.IdentityModel.Pages.FormsSignInPage.AuthenticateEventHandler(Object sender, AuthenticateEventArgs formAuthenticateEvent) +123
   System.Web.UI.WebControls.Login.AttemptLogin() +152
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +124
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981


In our situation this error occurs within in the “Security Token Service Application”. The problem with this error message is that it isn’t the exact message of what is going wrong. To receive that error message that is occurring do the following:

  1. Open IIS and navigate to “SharePoint Web Services” under “Sites”. Click the node open and select “SecurityTokenServiceApplication” use your other mouse button to open the context menu and select “Explore”.

    image

  2. Windows explorer will open a new window. In this window you will see a web.config file. Open this file within a text editor and look for the following section:
<behaviors>
  <serviceBehaviors>
    <behavior name="SecurityTokenServiceBehavior">
      <!-- The serviceMetadata behavior allows one to enable metadata (endpoints, bindings, services) publishing.
           This configuration enables publishing of such data over HTTP GET.
           This does not include metadata about the STS itself such as Claim Types, Keys and other elements to establish a trust.
      -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- Default WCF throttling limits are too low -->
      <serviceThrottling maxConcurrentCalls="65536" maxConcurrentSessions="65536" maxConcurrentInstances="65536" />         
    </behavior>
  </serviceBehaviors>
</behaviors>

In this section we will place a extra debug tag to include the errors that are occurring. The tag looks like this:

<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />

This tag needs to be placed in the behavior tag. After you place the tag in the section it will look like this:

<behaviors>
  <serviceBehaviors>
    <behavior name="SecurityTokenServiceBehavior">
      <!-- The serviceMetadata behavior allows one to enable metadata (endpoints, bindings, services) publishing.
           This configuration enables publishing of such data over HTTP GET.
           This does not include metadata about the STS itself such as Claim Types, Keys and other elements to establish a trust.
      -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- Default WCF throttling limits are too low -->
      <serviceThrottling maxConcurrentCalls="65536" maxConcurrentSessions="65536" maxConcurrentInstances="65536" />
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

After changing the “web.config” we received the correct message and we saw that we mistyped the role provider name.

Server Error in ‘/’ Application.


Cannot get Role Manager with name Empty. The role manager for this process was not properly configured. You must configure the role manager in the .config file for every SharePoint process.

Http Redirect with Query string in IIS 7

In the last couple of years I have had several url’s for my blog:

When I migrated my blog to my own Virtual Private Server I placed all of my articles on SharePoint Foundation. In order to also access my blog with the other url’s I created some alternate access mappings and changed the bindings within IIS.

But what I really wanted was a Http redirection with a 301 status code. If you enable this by default in IIS you will be redirected to the top level. But it is also possible to redirect with the query string.

Step 1:

Create a new website and add the binding you want.

Step 2:

Click on the website. In the feature view you will find Http redirect:

IIS

Step 3:

Add the url you want to redirect to and add “$V$Q”. To pass the query string. Also select “Redirect all request to exact destination.

From the dropdown choose Permanent (301):

httpRedirect