My ASP.NET C# website is not starting when deployed to IIS. I followed the steps on this page:
I also tried to deploy my app as an application as well. The problem I'm hitting is that the app pool eventually stops, and when trying to browse it while restarting the app pool + iis reset I get an error
This site can't be reached
with an error code of ERR_CONNECTION_REFUSED when deployed as a website.
When deployed as a web app, I get the below stack trace error.
I have enabled 32 bit applications in my app pool advanced settings as this is a x86 compiled web app. It has ties to a database that is configured as localhost in the connection settings.
When running my web site through visual studio it runs just fine including the database connection.
When deploying a simple HTML app using the same steps used to deploy my asp.net app, the web spins right up and is even viewable to the outside world (so not a firewall/iis issue).
[BadImageFormatException: Could not load file or assembly 'SolutionsWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22 System.Reflection.Assembly.Load(String assemblyString) +34 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48 [ConfigurationErrorsException: Could not load file or assembly 'SolutionsWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +725 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +247 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +157 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +319 System.Web.Compilation.BuildManager.ExecutePreAppStart() +170 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +820 [HttpException (0x80004005): Could not load file or assembly 'SolutionsWeb' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688
When researching this in event viewer, the application event logs seem to display my actual issue. This seems to be what i need to resolve. I would appreciate insight as to how i can resolve this issue:
Faulting application name: w3wp.exe, version: 10.0.17763.1, time stamp: 0xa7ccada2 Faulting module name: clr.dll, version: 4.7.3416.0, time stamp: 0x5cabfd2c Exception code: 0xc00000fd Fault offset: 0x0045510d Faulting process id: 0x2ac4 Faulting application start time: 0x01d55ab8fc19c034 Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Report Id: 564020d7-d5f1-44d0-b142-8b56239aabee Faulting package full name: Faulting package-relative application ID:
Login failed for user 'IIS APPPOOL\SolutionsWeb'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] Event ID: 18456 Qualifiers: 49152 Fault bucket 1336845626185276286, type 1 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: w3wp.exe P2: 10.0.17763.1 P3: a7ccada2 P4: clr.dll P5: 4.7.3416.0 P6: 5cabfd2c P7: c00000fd P8: 0045510d P9: P10:
Like i said, after a little bit, the app pool stops due to the failures and the web goes offline entirely.
Any help is very appreciated. Thank you.
Figured it out... it was my database connection. I had it set to use win auth yet security for my system user was not being granted access. I decided to just add a web user account to access the database and use sql auth, and the error went away. My web site is now online.
User contributions licensed under CC BY-SA 3.0