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

提前致谢

4

2 回答 2

0

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

除此之外,您的 web.config 文件还有许多其他问题,如密钥位置错误、末端元素不匹配、xml 格式错误等。使用 web.config 文件时要记住的两个重要事项是文件必须格式正确, 有效的 xml 并且元素和属性名称区分大小写。换句话说<mailSettings>,是一个有效的元素名称,但<mailsettings>不是。

我建议您参考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]

我已经纠正了我在下面的示例中可以找到的所有错误。它确实做出了某些假设(例如您在 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>
于 2013-02-13T07:37:25.800 回答
0
<?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>
于 2014-01-22T05:11:34.293 回答