【发布时间】:2018-07-27 18:55:44
【问题描述】:
我使用 Visual Studio 2017 将网站转换为 Web 应用程序。转换后 Web 应用程序抛出以下错误。有没有解决此问题的方法
解析器错误消息:文件“/Global.asax.vb”不存在。
来源错误:
第 1 行:
【问题讨论】:
我使用 Visual Studio 2017 将网站转换为 Web 应用程序。转换后 Web 应用程序抛出以下错误。有没有解决此问题的方法
解析器错误消息:文件“/Global.asax.vb”不存在。
来源错误:
第 1 行:
【问题讨论】:
使用空白文档打开 NOTEPAD 应用程序。
将下面的代码粘贴进去
Option Explicit On
Imports Microsoft.VisualBasic
Imports System.Web.SessionState
Public Class Global_asax
Inherits System.Web.HttpApplication
'
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
End Sub
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
End Class
将文件另存为 GLOBAL.ASAX 在代码所在的应用程序的 ROOT 文件夹中。
下一个有错误标记的文件:
Line 1: <%@ Application Inherits="WebApplication1.Test.Global" Language="VB" CodeFile="Global.asax.vb" %>
将该行更改为以下内容:
<%@ Application Inherits="WebApplication1.Test.Global" Language="VB" %>
没有看到你的一些代码,因为没有发布代码,很难马上确定。
如果您按照上述操作,它应该可以帮助您克服所显示的错误。
【讨论】: