个位大哥大姐,我有个网站在发布时遇到了问题,所有的静态页面都能运行,可是只要一和数据库进行连接的,就报错。在本地测试又都是好的。唉,大哥大姐们,帮帮忙啊。小弟我在此先谢谢了。
报的错是:
Server Error in '/' Application.
--------------------------------------------------------------------------------Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
我的数据库连接语句是
con = new SqlConnection("Data Source=localhost;Initial Catalog=Commodities;Integrated Security=True;uid='sa';pwd='zhaoan18102'");拜托个位了!!!
报的错是:
Server Error in '/' Application.
--------------------------------------------------------------------------------Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
我的数据库连接语句是
con = new SqlConnection("Data Source=localhost;Initial Catalog=Commodities;Integrated Security=True;uid='sa';pwd='zhaoan18102'");拜托个位了!!!
吗? 没有的话加上,这样就能看到详细的错误信息了。
问下
你的数据库和代码是在同一台服务器上吗?
运行下面的命令: aspnet_regiis –ga ASPNET,然后重启IIS服务, aspnet_regiis –u 将已安装的SDK卸载,然后再运行aspnet_regiis –i,重新安装SDK2.0 重新启动IIS服务
数据库连接字符串
value="Data Source=(local);Initial Catalog=TEST;User ID=sa;Password=sa"
如是,可能是数据库用户名或密码不符,
2、在自己的机中,你是否把网站放在IIS的虚拟目录中,这样其它页面连接时数据库路径改了,就连不上了,
在自己的机测试,请不要设置虚拟目录进行测试,
3、我不明白很多人都中意用虚拟目录,我未用过!