簡體   English   中英

WebSite到WebApplication轉換的問題

[英]Issues with WebSite to WebApplication conversion

我使用Visual Studio 2017將網站轉換為Web應用程序。轉換后,Web應用程序引發以下錯誤。該問題是否有解決方案

解析器錯誤消息:文件'/Global.asax.vb'不存在。

源錯誤:

第1行:<%@ Application Inherits =“ WebApplication1.Test.Global” Language =“ VB” CodeFile =“ Global.asax.vb”%

用空白文檔打開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

在代碼所在的應用程序的ROOT文件夾中將文件另存為GLOBAL.ASAX。

接下來哪個文件有錯誤標記了它:

Line 1: <%@ Application Inherits="WebApplication1.Test.Global" Language="VB" CodeFile="Global.asax.vb" %>

將該行更改為以下內容:

<%@ Application Inherits="WebApplication1.Test.Global" Language="VB" %>

由於沒有發布代碼,因此看不到您的某些代碼,因此很難立即將其確定下來。

如果您按照上述步驟操作,應該可以避免顯示的錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM