首页 > 解决方案 > 解析器错误消息:无法加载类型“PatronWebUserUtility.PatronWebUserMaintenance”

问题描述

我们正在尝试发布一个简单的单页 ASPX/VB.NET 应用程序,该应用程序管理数据库中的单个表并且已经碰壁了。当我们在 Visual Studio 中运行应用程序时,它运行良好。但是,在发布到我们的 IIS 服务器(使用 Visual Studio 与我们的 PC 分开)后,应用程序会收到此错误。我们从其他帖子中尝试了很多建议,但在我们的实例中似乎没有任何区别。

该应用程序配置为针对 .NET 4 构建,并且 IIS 应用程序池也设置为 .NET 4。IIS 服务器版本为 8.0,在 Windows Server 2012 v6.2 上运行。

将应用程序发布到服务器时,它会生成以下文件结构:

bin(文件夹)

-PatronWebUserUtility.dll

-PatronWebUserUtility.pdb

-PatronWebUserUtility.xml

PatronWebUserMaintenance.ASPX

网络配置

我包含以上内容是因为我不确定所有内容都按应有的方式发布,但我不知道如何验证 DLL 中实际发布的内容。我假设 ASPX.VB 页面将包含在那里,但我只是不知道。

我们在 ASP 方面完全没有经验,只是在内部没有 ASP 开发人员的情况下试图通过这个小项目一瘸一拐地完成。下面的代码块在我们的实际应用程序代码之前停止,我认为这个查询不需要,但如果您需要更多信息来帮助,请询问!

错误信息:

Parser Error Message: Could not load type 'PatronWebUserUtility.PatronWebUserMaintenance'.

Source Error: 



Line 1:  <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="PatronWebUserMaintenance.aspx.vb" Inherits="PatronWebUserUtility.PatronWebUserMaintenance" MaintainScrollPositionOnPostback="true"%>
Line 2:  
Line 3:  <!DOCTYPE html>
  

 Source File:  /patronwebusermaintenance/PatronWebUserMaintenance.aspx    Line:  1 
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36480 

ASPX 页面标题:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="PatronWebUserMaintenance.aspx.vb" Inherits="PatronWebUserUtility.PatronWebUserMaintenance" MaintainScrollPositionOnPostback="true"%>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Patron Web User Maintenance</title>
</head>

ASPX.VB 页面标题:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Data.OleDb
Imports System.Web.UI

Public Class PatronWebUserMaintenance
    Inherits System.Web.UI.Page

网络配置:

<configuration>
  <appSettings/>
  <connectionStrings>
    <add name="PatronWebTestConnectionString" connectionString="Data Source=SQLSERVER;Initial Catalog=PatronWebTest;Integrated Security=True"
      providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
    <httpRuntime/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.webServer>
    <defaultDocument enabled="true">
      <files>
        <add value="PatronWebUserMaintenance.aspx" />
      </files>
    </defaultDocument>
  </system.webServer>
  
  
</configuration>

标签: asp.netvb.netiis

解决方案


根据您的描述,我猜您可能将 IIS 网站的物理文件路径设置为父路径而不是正确的路径。

我建议您可以尝试修改物理文件路径,然后重试。

更多细节,您可以参考以下步骤:

1.打开IIS管理控制台:

2.找到您使用过的网站。

3.右键单击网站并选择管理网站和高级设置

在此处输入图像描述

4.修改patronwebusermaintenance的物理路径而不是inetpub文件夹。

在此处输入图像描述


推荐阅读