分享

写回答

发帖

[提问] 详细的web.config错误排除

GoDaddy GoDaddy 1428 人阅读 | 1 人回复

发表于 2010-8-10 11:06:31 | 显示全部楼层 |阅读模式

我的网站是两年前用.NET写的(网站的配置文件名是web.config),想转到GD来,于是购买了150G的win虚拟主机,文件上传到空间,数据库(SQL)用DWS成功导入后,提示错误:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

于是去检查了文件权限设置,IIS权限设置,都是正确的设置,我看版主说default.aspx 要优先于index.htm解析,于是我新建了一个index.htm,然后把
“default.aspx”改成了“default1.aspx” 目的是不让default.aspx解析 看index.htm能否正常显示,结果还是:500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

接下来开始排除问题,结果发现把web.config中的

<connectionStrings>

     <add name="asd" connectionString="Data Source=asdasd; Initial Catalog=asdasd; User ID=asdasd; Password=asdasd"  providerName="System.Data.SqlClient" />
  </connectionStrings>

注释掉后index.htm即可成功显示。

然后把“default1.aspx”改回“default.aspx” 出现如下错误

***省略 <!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>省略*******

然后把<connectionStrings>

     <add name="asd" connectionString="Data Source=asdasd; Initial Catalog=asdasd; User ID=asdasd; Password=asdasd"  providerName="System.Data.SqlClient" />
  </connectionStrings>的注释去掉后 刷新页面提示:500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

说明最会祸首是“<connectionStrings>**** </connectionStrings>”


思路总结:1。规避权限问题看网站是否能正常显示信息
          2。用排除法在web.config找出触发了权限问题的语句
          3。触发问题的语句为:“<connectionStrings>**** </connectionStrings>”

坏爹的同学们这个问题有啥好方法解决?

回答|共 1 个

25259238

发表于 2010-8-10 11:09:04 | 显示全部楼层

不知道我的思路有没有错,希望版主看到后能给予一个小小的技术支持
您需要登录后才可以回帖 登录 | 注册

本版积分规则