【问题标题】:Issues with WebSite to WebApplication conversion网站到 WebApplication 转换的问题
【发布时间】:2018-07-27 18:55:44
【问题描述】:

我使用 Visual Studio 2017 将网站转换为 Web 应用程序。转换后 Web 应用程序抛出以下错误。有没有解决此问题的方法

解析器错误消息:文件“/Global.asax.vb”不存在。

来源错误:

第 1 行:

【问题讨论】:

    标签: asp.net .net vb.net


    【解决方案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" %>
    

    没有看到你的一些代码,因为没有发布代码,很难马上确定。

    如果您按照上述操作,它应该可以帮助您克服所显示的错误。

    【讨论】:

    • 我尝试了上述解决方案,但现在它在启动页面上抛出错误我的意思是主页看起来像这样,解析器错误消息:无法加载类型'WebApplication1.Test1.wc_ModulesNavigation'.Line 1: 第 2 行: 第 3 行:跨度>
    • 听起来您的某些文件丢失或不在编译器预期的位置...您确实需要从文件中发布一些代码,并且屏幕抓取会更好尝试将错误信息粘贴到 cmets...
    猜你喜欢
    • 1970-01-01
    • 2011-12-16
    • 2011-03-15
    • 2017-10-13
    • 2014-04-25
    • 1970-01-01
    • 1970-01-01
    • 2013-08-03
    • 1970-01-01
    相关资源
    最近更新 更多