所以,昨天我在我的开发机器上安装PHP和MySQL。从那时起,我得到尝试运行我的.NET项目之一,当出现以下错误:
So yesterday i installed PHP and MySQL on my development machine. Since then i get the following error when trying to run one of my .NET projects:
连接名称LocalSqlServer'未发现在应用程序的配置或连接字符串是空的。
The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
它引用这条线在machine.config的:
It references this line of the Machine.Config:
<add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
我在网上搜索,高,低,可以确认的是我的machine.config中具有必要的连接字符串:
I have searched online, high and low and can confirm that my machine.config HAS the necessary connection string:
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="LocalMySqlServer" connectionString="" />
有趣的是,我执行我的生产服务器端(server 2008)上安装PHP和MySQL的完全一样的操作,是没有问题的存在。我开发计算机是Windows 7操作系统。
Interestingly enough, i performed the exact same operation of installing PHP and MySQL on my production server (server 2008) and there is no problem there. My dev machine is Windows 7.
我的整个开发机器坏了。我怎样才能修复的machine.config或修复,并解决这个问题呢?有没有人经历过这一点?
My whole dev machine is broken because of this. How can i repair the machine.config or fix it and resolve this problem? Has anyone experienced this before?
猪兔
也许有一个web.config的地方,包括:
Maybe there is a web.config somewhere that contains:
<connectionStrings>
<clear/>
...
</connectionStrings>
您可能还需要仔细检查你正在寻找正确的machine.config。有每个Framework版本独立machine.configs,并为32位和64位架构也不同的。
You might also want to double-check that you're looking at the right machine.config. There are separate machine.configs for each Framework version, and also separate ones for the 32-bit and 64-bit framework.