解析器错误消息:连接名称“LocalSqlServer”在应用程序配置中找不到或连接字符串为空

发布于 2024-09-19 08:48:38 字数 1183 浏览 2 评论 0原文

我目前正在新的 SQL Server 2008 服务器上设置我的网站,但是收到以下错误:

 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: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

Source Error:

Line 158:        <roleManager>
Line 159:            <providers>
Line 160:                <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 161:                <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 162:            </providers>


Source File: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config    Line: 160 

这是为什么?我该如何解决这个问题?谢谢!

I'm currently setting up my website on a new SQL Server 2008 server, however I'm getting the following error:

 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: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

Source Error:

Line 158:        <roleManager>
Line 159:            <providers>
Line 160:                <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 161:                <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 162:            </providers>


Source File: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config    Line: 160 

Why is this? And how can I resolve the issue? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谷夏 2024-09-26 08:48:38

嗯,我以前从来没有这样做过
在 IIS6 上,这似乎没有必要。为了
如果您要添加一个
web.config 中的连接字符串
称为“LocalSqlServer”,它会发生冲突
与 machine.config?所以你有
删除连接
机将其添加​​到网络。这是
我所做的临时修复,但是
我从未在 IIS6 或
IIS7之前。

正如史蒂文所说,在这种情况下,您无需为此修改机器配置。

两台计算机之间肯定还有另一个不同之处导致了这种情况的发生。一对:

  • 您在新服务器中拥有一个,而不是在原始服务器中,
  • 您从另一个配置继承了一个。

Well I've never had to do this before
on IIS6 and it seems unnecessary. For
starters if you are to add a
connectionString in the web.config
called 'LocalSqlServer' it'll clash
with the machine.config? So you have
to remove the connection from the
machine to add it to the web. This is
what I've done as a temporary fix, but
I've never seen this setup on IIS6 or
IIS7 before.

As Steven said, you do a in that case, no need to modify the machine config for that.

There surely is another different between both computers for that to have happened. A couple:

  • you had a in the new server, and not in your original server
  • you are inheriting a from another config.
咋地 2024-09-26 08:48:38

您的配置文件的 部分缺少连接字符串:

<connectionStrings>
    <clear />
    <add name="LocalSqlServer" connectionString="[your connection here]" />
</connectionStrings>

You are missing a connection string in the <connectionStrings> section of you config file:

<connectionStrings>
    <clear />
    <add name="LocalSqlServer" connectionString="[your connection here]" />
</connectionStrings>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文