View Full Version : خطاي web.config
pazahr
سه شنبه 26 خرداد 1388, 14:40 عصر
من يك وب سايت به صورت محلي اجرا كردم و كامل و بدون ايراد به بانك اطلاعاتي اس كيو ال وصل ميشه و صفحه هاش باز ميشن و هيچ خطايي نميده.
كانكشن استرينگ رو توي web.config نوشتم
<appSettings/>
<connectionStrings>
<add name="universityCn" connectionString = "Provider=SQLOLEDB.1;Server=...;Database=university ;User ID=...;Password=...;Trusted_Connection=False;"
providerName="System.Data.oledb" />
</connectionStrings>
(نام سرور و كاربري و رمز هم درست هستن)
براي اينكه سايتو روي سرور ببرم كانكشن استرينگ رو متناسب اصلاح كردم و آپلود كردم.
با اينحال بعضي وقتها صفحات همراه با اتصال به بانك اطلاعاتي باز ميشن و بعضي وقتها خطاي زير رو نشون ميده :
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
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>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
لطفا راهنمايي كنيد مشكل از كجاست
silverfox
سه شنبه 26 خرداد 1388, 14:50 عصر
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
رو توی وب کانفیگ تغییر بده تا ارور رو نشون بده ببینی از چیه
pazahr
سه شنبه 26 خرداد 1388, 15:30 عصر
فايل web.config من به اين شكل بود :
<?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\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="universityCn" connectionString = "Provider=SQLOLEDB.1;Server=...;Database=university ;User ID=...;Password=...;Trusted_Connection=False;"
providerName="System.Data.oledb" />
</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.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.data"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
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.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
بعد از توضيح شما قسمت customerrors رو از توي كامنت در آوردم و آپلود و تست كردم :
ارور 404 رو داد يعني فايل main.aspx كه روي سايت بايد باشه و صفحه اصلي سايته نيستش! درحالي كه هست و با cuteftp آپلودش كردم و ميبينمش.
iman_22a
سه شنبه 26 خرداد 1388, 16:03 عصر
سلام دوست عزیز ، توی کنترل پنل هاست چک کنین ببینید توی لیست صفحات اصلی وب سایت اولویت با کدوم صفحه هستش ، صفحه موردنظر شما باید اولویت اول رو داشته باشه .
برای اطمینان بیشتر قبل از آپلود روی صفحه موردنظر کلیک راست کرده و Set As Startup Page رو هم بزنید بد نیست .
pazahr
سه شنبه 26 خرداد 1388, 16:32 عصر
ايمان جان
صفحه default page سايتم default.aspx هست كه بعد از لود شدن بلافاصله redirect مي كنه به main.aspx
مشكلي از اين جهت نيست. چون حتي وقتي كه كد هاي مربوط به دسترسي به بانك اطلاعاتي رو از main.aspx برمي دارم (كه در اون لحظه مي خواد بره سراغ connection string توي web.config) درست ميشه و اون خطا رو نميده
iman_22a
سه شنبه 26 خرداد 1388, 17:21 عصر
ايمان جان
صفحه default page سايتم default.aspx هست كه بعد از لود شدن بلافاصله redirect مي كنه به main.aspx
مشكلي از اين جهت نيست. چون حتي وقتي كه كد هاي مربوط به دسترسي به بانك اطلاعاتي رو از main.aspx برمي دارم (كه در اون لحظه مي خواد بره سراغ connection string توي web.config) درست ميشه و اون خطا رو نميده
سلام . حواسم به همشهری بودنت نبود :چشمک:
از این نوشته ها چیزی مشخص نمیشه (حداقل واسه من) . اگر پیغام خطا رو اینجا قراربدی بهتر میشه برسی کرد .
یه احتمال خیلی ضعیف اینه که فراموش کرده باشی که فایل DLL مربوط به این صفحه رو آپلود کنی .
pazahr
چهارشنبه 27 خرداد 1388, 12:39 عصر
از جناب silverfox متشكرم
كاري رو كه گفتن انجام دادم و فعلا مشكلم حل شد.
از ايمان عزيز هم ممنونم :لبخندساده:
fathollah
شنبه 13 آذر 1389, 06:38 صبح
آقا نمی دونم چه کار کنم.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
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>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.