Tree View works through VWD but not via local host or from a remote browser. /Server Error in '/' Application.

本文讨论了一个关于TreeView在本地和远程浏览器中无法正常加载的问题。该问题源于.NET Framework版本不匹配,具体表现为应用尝试使用.NET 1.x运行针对.NET 2.0设计的控件。通过确保安装了正确的.NET Framework版本并配置IIS使用该版本,问题得以解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Tree View works through VWD but not via local host or from a remote browser.

Running the application through visual web developer and it works fine. But through local host or remotely, I get the following error:

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: Could not load type System.Web.UI.WebControls.SiteMapDataSource from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

Source Error:

Line 7: <body>
Line 8: <form runat="server">
Line 9: <asp:SiteMapDataSource ID="mySiteMapDataSource"
Line 10: runat="server" />
Line 11: <asp:TreeView ID="myTreeView" runat="server"

Source File: c:/inetpub/wwwroot/sitemap_and_tree_view/TreeViewDemo.aspx Line: 9




--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2379; ASP.NET Version:1.1.4322.2379



The code in the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<title>TreeView Demo</title>

</head>

<body>

<form runat="server">

<asp:SiteMapDataSource ID="mySiteMapDataSource"

runat="server" />

<asp:TreeView ID="myTreeView" runat="server"

DataSourceID="mySiteMapDataSource" />

</form>

</body>
</html>

The sitemap file code:

<siteMap

xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode title="Home" url="~/Default.aspx"

description="Home">
<siteMapNode title="TreeViewDemo" url="~/TreeViewDemo.aspx"

description="TreeView Example" />
<siteMapNode title="ClickEvent" url="~/ClickEvent.aspx"

description="ClickEvent Example" />
<siteMapNode title="Loops" url="~/Loops.aspx"

description="Loops Example" />
</siteMapNode>

</siteMap>


I'm at a loss as it appears it's exactly as the book describes it.
foolios is offline   Reply With Quote
Old Yesterday, 18:49   #2
Community Advisor
SitePoint Award Recipient
 
wwb_99's Avatar
 
Join Date: May 2003
Location: Washington, DC
Posts: 5,344
Key thing to note is
Quote:
System.Web, Version=1.0.5000.0
Your app is running in .NET 1.x, and DataSourceControls in general are .NET 2.0 or better controls. Make sure the .NET framework 2.0 is installed and that you have the virtual directory setup for .NET 2.0.
wwb_99 is offline   Reply With Quote
Old Yesterday, 21:11   #3
SitePoint Enthusiast
 
foolios's Avatar
 
Join Date: Dec 2006
Location: The least technologically advanced state in the US
Posts: 75
Thank you for this information. I checked what version is installed via add/remove programs and I see .net 2 framework is installed. I went to IIS and see that it is using 1.1. Could someone point out how I can tell IIS to use 2.0 instead?
Thanks so much.

Found it, Thank you.

http://hkvstore.com/aspnetmaker/doc/aspnet2primer.htm
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值