【发布时间】:2019-08-24 20:35:00
【问题描述】:
我的 ASP.NET C# 网站在部署到 IIS 时没有启动。我按照此页面上的步骤操作:
https://www.c-sharpcorner.com/article/access-website-hosted-on-iis/
我也尝试将我的应用程序部署为应用程序。我遇到的问题是应用程序池最终停止,并且在重新启动应用程序池 + iis 重置时尝试浏览它时出现错误
无法访问此网站
部署为网站时错误代码为 ERR_CONNECTION_REFUSED。
当部署为 Web 应用程序时,我收到以下堆栈跟踪错误。
我在我的应用程序池高级设置中启用了 32 位应用程序,因为这是一个 x86 编译的网络应用程序。它与在连接设置中配置为 localhost 的数据库相关联。
当通过 Visual Studio 运行我的网站时,它运行良好,包括数据库连接。
使用与部署我的 asp.net 应用程序相同的步骤部署一个简单的 HTML 应用程序时,网络会立即启动,甚至可以被外界看到(因此不是防火墙/iis 问题)。
[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
在事件查看器中研究此问题时,应用程序事件日志似乎显示了我的实际问题。这似乎是我需要解决的问题。我希望能深入了解如何解决此问题:
错误:
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:
就像我说的,过了一会儿,应用程序池由于故障而停止,网络完全离线。
非常感谢任何帮助。谢谢。
【问题讨论】:
标签: asp.net iis deployment