تنظیمات فایل web.cofig رو برام روشن کنین

tabeez68

New Member
سلام دوستای عزیز
من یه برنامه برا سایتی که میخوام راه بندازم نوشتم که 5 6 صفحه داره
رو لوکال سرور کامپیوترم خوب اجرا میشه یعنی وصل که نیستم اجرا میشه و خوب کار میده ولی وقتی رو هاست میزارم و تو سایتم از فایل web.config اشکال میگیره. اینهم مشکلا :
<authentication mode="window" />
از این اشکل میگیره و اینم توضیحشه

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 37: by Microsoft that offers a single logon and core profile services for member sites.
Line 38: -->
Line 39: <authentication mode="windows" />
Line 40:
Line 41:


و از چیز دیگه که اشکل میگیره اینه
<customErrors mode="RemoteOnly" />

که فکر کنم میگه باید آف باشه به جای ریموت اونلی


خواهشن راهنمائیم کنین که مشکلم حل شه
 
آخرین ویرایش:

m_ziba

Member
customErrors mode="RemoteOnly یعنی معنی دقیق error ها رو فقط وقتی می تونی ببینی که پای server نشسته باشی و error ها از دید کاربران هادی سایت مخفی هستن.
mode رو باید Off بذاری تا متن اصلی error رو بتونی ببینی.
 

tabeez68

New Member
خب اینکارو میکنم ولی بازم داره مشکل میگیره اخه چیکار کنم من تو رو خدا کمکم کنین اعصابم ریخته به هم اساسی
امشب هم باز این ارر رو داد

Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 37: by Microsoft that offers a single logon and core profile services for member sites.
Line 38: -->
Line 39: <authentication mode="RemoteOnly"/>
Line 40:
Line 41:


Source File: C:\...\...\...\...\AddList\httpdocs\mehrdad\web.config Line: 39



Show Additional Configuration Errors:


It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (C:\...\...\...\...\AddList\httpdocs\mehrdad\web.config line 72)




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

جان من زود که منتظرم
 
آخرین ویرایش:

arashkey

Member
برای منم تو همین مایه هاست ولی اینجوریه
کد:
 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>
داخل فایل web.config این نوشته شده
کد:
  <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>
  <system.net>
 

m_ziba

Member
جناب arashkey !
مثل اینکه پاسخی رو که من به دوستمون دادم رو نخوندی.

customErrors mode="RemoteOnly یعنی معنی دقیق error ها رو فقط وقتی می تونی ببینی که پای server نشسته باشی و error ها از دید کاربران عادی سایت مخفی هستن.
mode رو باید Off بذاری تا متن اصلی error رو بتونی ببینی.
 

arashkey

Member
ببخشید حق با شما بود
می تونید بگید اشکال از چیه
http://www.taktap.com/temp/Default.aspx

به من یه همچین پیغامی رو می ده
می گید چی کار کنم
از دستور #include هم استفاده کردم
البته پرمیژن ران رو به همه دادم
فولدر bin رو هم در داریکتوری روت کپی کردم
کد:
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
   System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +270
   System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +163
   System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +192
 
بخشی از توضیحات فایل web.config
--------------------------------------------
Web.Config
While Machine.Config lays out the default setting for your applications, the default settings are generally targeted toward the most common use cases (rather than some special configuration you may need to apply to your application). For example, sessionState is configured to be handled in process by default. That's fine when you're developing, but almost certainly is not appropriate for a commercial-grade application that is servicing many diverse clients.

Because all your .NET applications depend upon Machine.Config to configure them, making changes to Machine.Config could potentially affect your other applications. It's a bad idea to update Machine.Config directly.

Stand-alone .NET applications depend upon configuration files modeled after the application name to configure themselves. For example, an application named MyApp.EXE would have a configuration file named Myapp.EXE.Config. Of course, ASP.NET applications aren't named in that way. Instead, the ASP.NET runtime expects configuration information to be declared in a file named Web.Config.

To override the default settings within Machine.Config, you simply need to include a file named Web.Config in your application's virtual directory. For example, the following code sets up the Web application to which it applies. The Config file turns on Forms Authentication and tracing.

<?xml version="1.0" encoding="utf-8"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authentication mode="Forms" />
<trace enable=true/>
</system.web>
</configuration>
The configuration settings your application actually sees have been inherited from a (potentially) long line of other Web.Config files. Figure 9-1 illustrates how the configuration settings accumulate through the Web.Config file standing in the directory path taken by the request. After Machine.Config sets up the default configuration settings, different configuration files in the same path have the opportunity to tweak the settings for a single application. Figure 9-1 shows how configuration settings are modified via individual configuration files.

For example, the following configuration section will remove the ability for the AppSubDir directory to process standard ASP.NET Web Services. The remove instruction causes ASP.NET to have amnesia about all files with the extension .asmx.

<configuration>
<location path="appSubDir">
<system.web>
<httpHandlers>
<remove verb="*" path="*.asmx" />
</httpHandlers>
</system.web>
</location>
</configuration>
You could also apply other specific settings to the subdirectory. We'll look at security in depth in the next chapter. Of course, ASP.NET configuration files include terms to manage authorization and authentication. This is a perfect use for the local element. The following configuration snippet allows all users into the main (virtual) directory while requiring users wanting access to the PagesRequiringAuth subdirectory to be authenticated.

<configuration>
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<location path="pagesRequiringAuth">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
</configuration>

 

arashkey

Member
کارهایی که می خوایی کلی باشه توش انجام می گیره
مثلا تو می خوایی سایت رو کامپایل کنی ولی در زمان کامپایل نمی دونی اسم دیتابیست اسم یوزر نیم و ... چیه
برای همین تو قسمت این وب دات کانفیگ یه کلید استرینگی می سازی و یک Connection string هم توش می زاری
و تو کل سایتت از این کانکشن استرینگ استفاده می کنی
حالا وقتی پروژه رو کامپایل کردی می تونی بری تو همین فایل و بدون اینکه کل سایتت رو دوباره بگردی دنبال connection string از طریق همین فایل web.config یه تغییر می دی و همه جا اعمال می شه
بیشتر این فایل برای کار کردن با چیزهایی هستش که تو کل پروژت استفاده می شه
مثلا عمل دیباگ کردن رو اگه بخوایی برای کل سایتت از کار بندازی می یایی اینجا تعیین می کنی ( چون تو هر فایل که می سازی هم می شه تک تک این دیباگینگ رو به false تبدیل کرد ولی وقت گیره)
ولی نمی دونم چرا هیچ کسی مشکل من رو نمی دونه چیه
http://www.taktap.com/temp/default.aspx
 

m_ziba

Member
ولی نمی دونم چرا هیچ کسی مشکل من رو نمی دونه چیه
http://www.taktap.com/temp/default.aspx

سلام
آیا مشکل از وقتی پیش اومده که سایت رو روی host گذاشتی یا روی local هم این مشکل بوده؟
اگر مشکل host هست که باید با پشتیبان host تماس بگیری تا تنظیمات امنیتی رو درست کنه.
 
در ادامه فرمایشات m_ziba جان بگم که :

اگه مشکل رو سیستم خودتون باشه و این ارور صفحه یک که فرمودین رو مشاهده میکنید - راه حلش اینه :
به کنترل پنل برین و گزینه Administrative Tools رابرین و اونجا Microsoft .NET Framework 2.0 Configuration رو انتخاب کنید ( از 2005 استفاده میکنید دیگه؟ به احتمال زیاد - بله)
یه پنجره باز میشه که 2 قسمت جپ و راست داره - از قسمت چپ My Computer رو گسترش بدین و گزینه Runtime Security Policy رو بزنید - حالا از سمت راست لینک دومی ( Adjust Zone Security ) رو بزنید - یه ویزارد باز میشه اولی رو NEXT بزنید - ( گزینه بالایی باید انتخاب باشه ) - در مرحله بعدی Local Intranet رو انتخاب کنید و میله لغزان رو کاملا به بالا ببرید تا به Full Trust برسد و بعد NEXT و FINISH -
حالا VS 2005 خودتون رو باز و بسته کنید - باید حل شده باشه مشکل Error .
اما باز اگه مسئله ای بود بگین ...

یا علی
حالا Visual Studio 2005 خود را باز و بسته کنید - مشکل ایشالا که حل شده!
اما اگه مسئله خاصی بود باز بگین تا اگه بتونیم کمک کنیم


شاد باشید.
 

arashkey

Member
نه مشکل از لوکال نیست
من رو اینترنت مشکل دارم
کد:
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +72
   System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58
   System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +64
   System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +51
   System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +38
 
آخرین ویرایش:

arashkey

Member
می شه برام روشن کنید ماهیت این Error چیه
چرا یه همچین اشکالی به وجود می یاد
از چه دستوراتی استفاده کردم که یه همچین اشکالی به وجود اومده
 

m_ziba

Member
می شه برام روشن کنید ماهیت این Error چیه
چرا یه همچین اشکالی به وجود می یاد
از چه دستوراتی استفاده کردم که یه همچین اشکالی به وجود اومده

آیا فقط صفحه default مشکل داره یا همه صفحه های سایتتون؟
اگه فقط همین صفحه است که باید کدی که توی این صفحه دارین رو بفرستین
اگه همه صفحه ها error می ده مشکل از کد شما نیست مشکل تنظیمات امنیتی هاست شماست.
 

جدیدترین ارسال ها

بالا