web.config文件出错了!应该怎么配置啊?

ramiro 2006-04-23 12:04:18
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authentication mode="None"/>
<appSettings>
<add key="ConnectionSqlServer" value="Data Source=Tony;Initial Catalog=northwind;User Id=sa;Password=aaa;"></add>
</appSettings >
</system.web>
</configuration>
出错信息:

行 3: <system.web>
行 4: <authentication mode="None"/>
行 5: <appSettings>
行 6: <add key="ConnectionSqlServer" value="Data Source=Tony;Initial Catalog=northwind;User Id=sa;Password=aaa;"></add>
行 7: </appSettings >
...全文
197 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
songming1984 2006-04-23
  • 打赏
  • 举报
回复
<appSettings>应该写在</configuration>内
webwait 2006-04-23
  • 打赏
  • 举报
回复
<appSettings>写在<configuration>内,<system.web>外
xiaozuo2005 2006-04-23
  • 打赏
  • 举报
回复
<appSetting>
ramiro 2006-04-23
  • 打赏
  • 举报
回复
源文件: F:\MyWebSite\mywebsite\web.config 行: 5
webwait 2006-04-23
  • 打赏
  • 举报
回复
参考这个
<?xml version="1.0"?>

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="Northwind" connectionString="Server=localhost;Integrated Security=True;Database=Northwind" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>

<anonymousIdentification enabled="true" />
<profile> //定义配置(profile)
<properties>
<add name="Theme" allowAnonymous="true" />
<add name="LastVisit" type="System.DateTime" allowAnonymous="true" />
</properties>
</profile>
<!--
<webParts> //定义配置(webParts)
<personalization defaultProvider="AspNetSqlPersonalizationProvider"/>
</webParts>
-->
<!--
Set compilation debug="true" to insert debugging symbols into the compiled page.
Because this affects performance, set this value to true only during development.
-->
<compilation debug="true">
<expressionBuilders>
<add expressionPrefix="Version" type="VersionExpressionBuilder"/>
</expressionBuilders>
</compilation>
<!--
The <authentication> section enables configuration of the security authentication
mode used by ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration of what to do if/when an unhandled
error occurs during the execution of a request. Specifically, it enables developers
to configure html error pages to be displayed in place of a error stack trace.
-->
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<!--
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
-->
</customErrors>
</system.web>
</configuration>

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧