将我的web文件上传到服务器后,在godaddy中获取web.config文件错误和500错误

本文关键字:错误 文件 web godaddy 获取 config 我的 服务器 | 更新日期: 2023-09-27 17:58:50

<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

提前感谢

将我的web文件上传到服务器后,在godaddy中获取web.config文件错误和500错误

您在配置文件的appsettings部分中有连接字符串,它应该在connectionstring部分中。

除此之外,您的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>