简体   繁体   中英

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>

When I tried to connect the database with this string from my local system the error lies in the connection string.

I tried to change the custom errors content off and added detail error still the error persists. And I am a beginner in asp.net I've developed a website and I've uploaded for the testing purpose, I want to see the error detail clearly what changes need to be done that web page.

After publishing the website I can't see the app code in the folder what would be the reason is that the reason for errors

please check this link http://www.ticket65.com/test

Thanks in Advance

You have the connection string inside the appsettings section of the configuration file, it should be inside the connectionstrings section.

Beyond that, your web.config file has a number of other issue with keys in the wrong locations, mismatched end elements, malformed xml etc. Two important things to remember when working with a web.config file are that the file must be well formed, valid xml and the element and attribute names are cases sensitive. In other words <mailSettings> is a valid element name but <mailsettings> is not.

I would suggest you refer to system.web Element (ASP.NET Settings Schema) , How to: Read Connection Strings from the Web.config File and system.webServer Section Group [IIS Settings Schema]

I've corrected all the errors I could find in in my sample below. It does make certain assumptions (such as you being on IIS7 and using an app pool running the .net 4.0 framework.)

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM