locked
ASP.NET application initialization is failing on Server 2016/IIS 10 RRS feed

  • Question

  • User917540777 posted

    I have no idea if this is the correct place to post this, but we're trying to run our application on Server 2016 and all of our app pools are failing to start.  This is the error found in the event log:

    An error occurred while trying to start an integrated application instance.

    Exception: System.InvalidCastException

    Message: Specified cast is not valid.

    StackTrace: at System.Web.Configuration.ServerConfig.get_UseMetabase()
    at System.Web.Configuration.ServerConfig.GetInstance()
    at System.Web.Configuration.ServerConfig.GetDefaultDomainInstance(String version)
    at System.Web.Hosting.ISAPIApplicationHost..ctor(String appIdOrVirtualPath, String physicalPath, Boolean validatePhysicalPath, IProcessHostSupportFunctions functions, String iisVersion)
    at System.Web.Hosting.ProcessHost.CreateAppHost(String appId, String appPath)
    at System.Web.Hosting.ProcessHost.StartApplication(String appId, String appPath, Object& runtimeInterface)

    I turned on failed request tracing and the logs from that didn't provide any additional data.  I suspect this is some sort of misconfiguration on our part, but I have no idea where to start.  I've already fumbled around adding various IIS and .net roles and features, but nothing has worked so far.

    Tuesday, November 15, 2016 8:14 PM

All replies

  • User564952083 posted

    Have you looked or posted this on https://forums.iis.net/

    Tuesday, November 15, 2016 8:22 PM
  • User917540777 posted

    I have looked, but I haven't posted there yet.  I came across one post where someone was seeing something similar and the first reply was directing them to post here because it was an asp.net problem, not an iis problem.  Cross-posted on the iis forum now.  Hopefully someone can help.

    Tuesday, November 15, 2016 8:40 PM
  • User-2057865890 posted

    Hi Silentnoise,

    It looks like there's a problem casting a result from the database or something.

    Set the debug attribute in the configuration section of the Web.config file that is located in the root of the application folder to true, as follows:

    <configuration>  
        ...  
        <system.web>  
            <compilation  
                debug="true"  
                ...  
            >  
            ...  
            </compilation>  
        </system.web>  
    </configuration>  
    

    It is a good idea to enable debugging only when a developer is doing interactive troubleshooting, fix your problem and turn debug=“false” back again.

    Best Regards,

    Chris

    Tuesday, November 22, 2016 7:36 AM
  • User917540777 posted

    Hi Chris,

    Thanks for the tip.  There's no database interaction (from our product anyway) at this point.

    I tried setting the debug attribute and didn't get any additional information.

    I'm pretty sure the problem is related to some asp.net compatibility issue.  I've reproduced the problem on the default website when our application is installed and asp.net is configured via the roles and features GUI.  If I disable asp.net via the same method, the default website works.  Likewise, if our application isn't installed and asp.net is enabled via the GUI, the default website is fine.

    We are using .net 4.5.1 in our product.

    Any ideas?

    Thanks!

    Liz

    Tuesday, November 22, 2016 5:11 PM
  • User-2057865890 posted

    Hi Silentnoise,

    Are you using the default application pool? Could you post IIS application pool settings screenshot? Have you tried changing appliction pool? If necessary 32-bit applications are enabled on the application pool. 

    ASP.NET Web Deployment steps

    Best Regards,

    Chris

    Tuesday, November 29, 2016 9:26 AM
  • User917540777 posted

    No, I'm not using the default application pool.  All of our app pools are set to .net clr version 4.0, 32-bit applications are not enabled, and the managed pipeline is integrated.

    Before posting to here, I tried allowing 32-bit applications.  Our web apps are 64 bit, so this just caused things to fail in a different way.  I also tried changing the managed pipeline to classic, which results in a Bad Request, but no additional information in the failed request trace.

    All of our sites and app pools work just fine on Server 2012 R2 with IIS 8.  

    Tuesday, November 29, 2016 9:03 PM
  • User-2057865890 posted

    Hi Silentnoise,

    <configuration>
       <startup>
          <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
       </startup>
    </configuration>

    reference:

    https://msdn.microsoft.com/en-us/library/w4atty68(v=vs.110).aspx

    https://msdn.microsoft.com/en-us/library/jj152935(v=vs.110).aspx 

    Best Regards,

    Chris

    Tuesday, December 6, 2016 3:30 AM