【发布时间】:2012-08-21 21:18:49
【问题描述】:
我正在尝试在远程服务器上部署带有数据库 (SQL Server 2008) 的 ASP.NET 网站。但是,我从 WebConfig 文件中收到错误消息。
WEBCONFIG:
在 VS 2010 中,WebConfig 包含:
<configuration> <system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=SOMETOKEN"/> </assemblies> </compilation> </system.web> </configuration>
当我在网络服务器上运行页面时,我得到了这个错误:
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>
所以,我添加了<customErrors mode="Off"/> 并将我的 Web.Config 修改为:
<compilation debug="false" targetFramework="4.0">
<customErrors mode="Off"/>
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
但这无济于事。我仍然遇到同样的错误。我错过了什么?我记得部署其他没有组件的项目(* .dlls),效果很好。大会是不是搞砸了什么?如果是的话,你能建议修复吗?
我很惊讶,没有单独的教程来解释 ASP.NET“网站”的部署,以及应该如何处理 web.config 文件。使用组件时应特别注意(如果有的话)。
对于顺利部署相同功能的帮助,我将不胜感激。谢谢。
【问题讨论】:
-
首先,make debug=true,因为你现在正在调试。但我敢肯定,在您打开 customErrors mode=Off 后,您不会遇到同样的错误。基本上你的第一个错误说'嘿,发生了一个错误,但我们还没有向你展示它。改变 CustomErrors="Off" 我们会告诉你的。这是您在更改后遇到的错误,它对您和我们都有益且有益。
标签: c# asp.net deployment web-config database-connection