gpt4 book ai didi

asp.net - 在 asp.net c# 中添加母版页后,MySql 主机出错

转载 作者:行者123 更新时间:2023-12-04 21:56:44 27 4
gpt4 key购买 nike

我创建了一个 Web 应用程序,它从 mysql 获取数据并显示在 gridview 中。不同的页面用于不同的数据。
但现在我添加了便于用户导航的菜单项。

为此,我添加了站点地图、母版页。

我的 default.aspx 充当登录页面。
添加此母版页后,当我尝试打开应用程序时,它显示以下错误消息。

Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unable to connect to any of the specified MySQL hosts.

Source Error:


Line 178: <siteMap>
Line 179: <providers>
Line 180: <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 181: </providers>
Line 182: </siteMap>


Source File: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 180

下面是 default.aspx 页面
<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SimERP._Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
width: 55px;
}
.style2
{
width: 55px;
height: 32px;
}
.style3
{
height: 32px;
}
</style>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<body>
<link href="CSS/styles.css" rel="stylesheet" type="text/css" />
<form id="form1" runat="server">

<tr>
<td width="20px" class="style2"></td>
<td class="style3">User Name</td>
<td class="style3">Password</td>
</tr>
<tr>
<td align=center class="style1">
&nbsp;</td>
<td align=left>
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
</td>
<td align=l>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
</td>
</tr>

<tr>
<td height="60px" align="center">
<asp:ImageButton ID="imgBtnSignIn" runat="server"
ImageUrl="~/images/SignIn.jpg" onclick="imgBtnSignIn_Click" />
</td>
</tr>
</table>
</form>
</body>
</asp:Content>

最佳答案

MySql 在机器配置中安装了一个默认的站点地图提供程序:

<siteMap>
<providers>
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</siteMap>

在 system.web 部分下的 web.config 中添加了以下内容以排除它
<siteMap>
<providers> <remove name="MySqlSiteMapProvider" /> </providers>
</siteMap>

关于asp.net - 在 asp.net c# 中添加母版页后,MySql 主机出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30865505/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com