I have a SharePoint 2013 environment running on Windows Server 2012 with two web applications, each on a separate web site. As far I as know, it's current with updates.

The server shares the sites with a non-SharePoint ASP.NET application (ASP.NET MVC 4.0 under .NET 4.5). It appears to be properly excluded from SharePoint as it should be - I can navigate to it, use it, etc.

Today I deployed a second ASP.NET application (also an ASP.NET MVC 4.0 application under .NET 4.5) through a file copy to the server. I created a virtual directory in IIS pointing at the folder, and I marked it as an application.

However, I can't seem to get it to work as expected. SharePoint seems to have to be involved, and it's unhappy, so I'm broken either way. Details:

  • If I put the application into the same application pool at the SharePoint site, I can get to a text file in the application, but for ASP.NET code I get Dynamic operations can only be performed in homogenous AppDomain. I found some references to changing settings in web.config or machine.config but the setting in question isn't present on the server.

  • If I put it into its own application pool set (in Integrated mode; the other application is working with its own app pool in Integrated mode), I get a simple 500 error. Nothing shows in the ULS log or the Event Log. Failed Request Tracing simply indicates the 500 - there's nothing else in the XML file except the 500 error result (no real tracing in other words).

  • If I put it into its own application pool set for 'Classic' mode, I get:

    [InvalidOperationException: The farm is unavailable.] Microsoft.SharePoint.Administration.Claims.SPSecurityTokenServiceManager.get_Local() +459 Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandler..ctor() +108

The web.config is very simple:

<?xml version="1.0" encoding="utf-8"?>
  For more information on how to configure your ASP.NET application, please visit
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="deletedForPost" />
    <add name="EFContainer" connectionString="detedForPost" providerName="System.Data.EntityClient" />
    <add key="webpages:Version" value="" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <compilation targetFramework="4.5">
        <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="None" />
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
    <validation validateIntegratedModeConfiguration="false" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="" newVersion="" />
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="" newVersion="" />
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="" newVersion="" />
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
        <bindingRedirect oldVersion="" newVersion="" />
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="" newVersion="" />
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
        <parameter value="v11.0" />

I'm not sure where to even look at this point to move forward with this. Ideas?

2 Answers 2


I kept coming across this question while researching this same problem in my SP2013 deployment. Thought I'd add the answer in case anyone else has this problem.

Sharepoint does indeed exclude managed paths by default. However, if you create a VD or Application under the the main SP web site, it's going to inherit web.config values regardless of if it's included as a managed path. Obviously, you need these config values if you want SP to handle things for you, but we want to remove these.

Add/modify the web.config in the virtual directory/application with the following:

<remove name="FederatedAuthentication" />
<remove name="SessionAuthentication" />
<remove name="SPApplicationAuthentication" />
<remove name="SPWindowsClaimsAuthentication" />

This gets some of the SP handlers out the way and it won't get in the way of your application.


I have spent a long time trying to get my ASP.net winforms and MVC 5 Apps to sit along side of Sharepoint 2013 using their own application pool. I though this answer will help others with resolving this issue.

My end goal is to have 3 or more application running on the 1 web server hosted on port 80 using.

  • Sharepoint 2013
  • MVC5App
  • WinFormsApp

This is how I resolved it. The end result will provide the following URL's

 - http://intranet/ 
 - http://intranet/Apps/MVC5App
 - http://intranet/Apps/WinFormsApp

Create a new application pool "MyAppsAppPool" that targets .net framework 4.0 and pipeline mode is integrated. Note: this is optional but I find it better to run my application in its own pool so it does not interfere with Sharepoint.

Create a folder C:\inetpub\wwwroot\Apps which will be used as a base for all your asp.net applications.

Add the following web.config file to the Apps folder.

<?xml version="1.0"?>
    <!-- Turn off all custom error message. This is useful in identifying what is going wrong.
         Note: use mode="RemoteOnly" if you just want to view error message on localhost.
    <customErrors mode="Off" />
    <!-- Enable Session State for pages which is disabled by Sharepoint 2013 
         This will resolve the "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive" message. -->
    <pages enableSessionState="true" /> 
    <!-- Disable legacyCasModel used by Sharepoint 2013. 
         This will resolve the "Dynamic operations can only be performed in homogenous AppDomain" message. -->
    <trust legacyCasModel="false" level="Full" />
      <!-- Remove All Modules used by Sharepoint 2013 -->
      <remove name="SPNativeRequestModule"/>
      <remove name="ScriptModule"/>
      <remove name="DesignHttpModule" />
      <remove name="SPRequestModule"/>
      <remove name="PublishingHttpModule"/>
      <remove name="StateServiceModule"/>
      <remove name="SharePoint14Module"/>
      <remove name="FederatedAuthentication"/>
      <remove name="SessionAuthentication"/>
      <remove name="SPWindowsClaimsAuthentication"/>
      <remove name="SPApplicationAuthentication"/>
      <!-- Re Enable sessions which are remove by Sharepoint 2013 -->
      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

Using IIS add an application to the Sharepoint Site using the following values

Alias: Apps
Application Pool: MyAppsAppPool
Physical Path: C:\inetpub\wwwroot\Apps

At this stage you should be able to serve a simple index.html file from the Apps folder. Always good to test your progress.

Now you can copy your MVC5App and WinFormsApp to the Apps folder and convert them to Applications which use the MyAppsAppPool.

As web.config file are inherited I find this method useful as I can easily create new virtual applications under the Apps folder without having to modify the web.config files for MVCApp and WinFormsApp.

I can easily copy any .net framework application to the Apps folder without having to worry about disabling sharepoint modules or enabling features that Sharepoint disabled.

Some useful resources that helped me with this issue but seemed to target Sharepoint 2010 are as follows. But note I did not need to go into the full extent which these articles suggest. I only need to perform the steps as listed above. I did not want to modify web.config for sharepoint and .net.

I didn't have enough rep to post more than two links. So reference links are provided in the comments.


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.