[英]Getting web.config file error and 500 error in godaddy after uploading my web files to the server
<configuration>
<system.net>
<mailsettings>
<smtp deliverymethod="Network" from="gdkpavan@gmail.com">
<network defaultcredentials="true" host="smtp.gmail.com" password="nprao@1111" port="587" username="pranayn5@gmail.com">
</network></smtp>
</mailsettings>
</system.net>
<appsettings>
<add key="con" value="Data Source=moviemaster.db.10502677.hostedresource.com; Initial Catalog=picketmaster; User ID=picketmaster; Password=Picket@500;">
</add></appsettings>
<connectionstrings>
<system.webserver>
<httperrors errormode="Detailed">
<asp scripterrorsenttobrowser="true">
</asp></httperrors></system.webserver>
<system.web>
<compilation debug="true" targetframework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A">
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
</add></add></add></assemblies>
</compilation>
<authentication mode="Windows">
<customerrors mode="Off">
<compilation debug="true">
</compilation></customerrors>
<pages clientidmode="AutoID" controlrenderingcompatibilityversion="4.0">
</pages></authentication></system.web>
<system.web>
<sessionstate mode="InProc" timeout="15">
</sessionstate></system.web>
</connectionstrings></configuration>
当我尝试使用本地系统中的此字符串连接数据库时,错误出在连接字符串中。
我试图更改自定义错误的内容,并添加了详细错误,但错误仍然存在。 我是asp.net的初学者,我已经开发了一个网站,并且已经上传用于测试,我想清楚地查看错误详细信息,需要对该网页进行哪些更改。
发布网站后,我在文件夹中看不到应用程序代码,这是因为错误原因
请检查此链接http://www.ticket65.com/test
提前致谢
您在配置文件的appsettings部分中具有连接字符串,它应该在connectionstrings部分中。
除此之外,您的web.config文件还存在其他一些问题,例如密钥的位置错误,末端元素不匹配,xml格式不正确等。使用web.config文件时要记住的两个重要事项是文件必须格式正确,有效的xml以及元素和属性名称区分大小写。 换句话说, <mailSettings>
是有效的元素名称,而<mailsettings>
不是。
我建议您参考system.web元素(ASP.NET设置架构) , 如何:从Web.config文件和system.webServer节组[IIS设置架构]中 读取连接字符串。
我已更正了以下示例中可能发现的所有错误。 它确实做出了某些假设(例如您在IIS7上并使用运行.net 4.0框架的应用程序池。)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="gdkpavan@gmail.com">
<network defaultCredentials="true" host="smtp.gmail.com" password="nprao@1111" port="587" userName="pranayn5@gmail.com" />
</smtp>
</mailSettings>
</system.net>
<connectionStrings>
<add name="con" connectionString="Data Source=moviemaster.db.10502677.hostedresource.com; Initial Catalog=picketmaster; User ID=picketmaster; Password=Picket@500;" />
</connectionStrings>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<authentication mode="Windows" />
<customErrors mode="Off" />
<pages clientIDMode="AutoID" controlRenderingCompatibilityVersion="4.0"/>
<sessionState mode="InProc" timeout="15" />
</system.web>
</configuration>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\vx.x\Config
-->
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="contactus@XXXXXXX">
<network host="XXXXXXXXX" port="25" userName="noreply@XXXXXXX password="XXXXXX" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
<appSettings>
<add key="con" value="Data Source=XXXXXXX; Initial Catalog=XXXXXXX; User ID=XXXXXXXX; Password=XXXXXXX;"/>
<!--<add key="SentMail" value="smtp.gmail.com"/>-->
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
->
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.web>
<customErrors mode="Off"/>
<sessionState mode="InProc" timeout="15"/>
</system.web>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.