asp.net系统发布后,报错 :Ambiguous match found. 解决办法

2022-10-22,,,,

Server Error in '/' Application.


Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Ambiguous match found.

Source Error:
 

Line 1:  <%@ page language="C#" autoeventwireup="true" inherits="testpage, App_Web_xhqm4rxi" %>

Line 2:  

Line 3:  <!DOCTYPE html>

Source File: /Function/IdentifyTable/IdentifyDetail_Form1.aspx    Line: 1

 

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34209

问题:

在本地运行没问题,但是发布到服务器之后就出现了问题。

解决方案:

它可能是因为组件的名称相同而出现的。

我去检查了我的页面发现在

aspx页面有一个控件名称是:ClassId

然后我发现我的cs页面也存在一个相同名称的变量:classid

由于cs页面的这个页面的变量大小写和前台的不一样,所以没有报错。并且在本地运行编译的时候是没问题的,是可以通过的。

由此可见在本地VS运行的时候前后台是区分了大小写的。所以没有出现问题,但是当我们发布编译的时候,并没有区分大小写,所以asp.net认为这就是一个变量,但是重复了。所以导致了这个 Ambiguous match found(找到不明确的匹配)的问题。

那么这里把这个变量换一个名字问题就解决了。

《asp.net系统发布后,报错 :Ambiguous match found. 解决办法.doc》

下载本文的Word格式文档,以方便收藏与打印。