Friday, May 22, 2009

Permission IIS7 on Vista

นั่งทดลองเขียน ajax กะ aspx บน vista iis7 รันหน้าแรกยังไม่ผ่านเลย O_o

ปัญหาที่ 1

Server Error

--------------------------------------------------------------------------------

HTTP Error 500.19 - Internal Server Error
Description: The requested page cannot be accessed because the related configuration data for the page is invalid.

Error Code: 0x80070005
  • คือ นำ folder เว็บ ajax ที่ทดลองเขียนไปวางที่หน้า desktop (drive c) และ ทำ visual host ไปที่หน้า desktop โดยตรง
  • เค้า บอกให้แก้ปัญหาเนี๋ย โดยเพิ่ม วิธีแรกไม่รู้เรื่อง ส่วนวิธีที่สอง permission ให้ iis_usrs ที่ Web.config ไฟล์ ไม่รู้เข้าใจถูกป่าว
Error message
Server Error in Application "application name"
HTTP Error 500.19 – Internal Server Error
HRESULT: 0x80070005
Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.

Cause of error message

This problem occurs for one of the following reasons:
  • You are using IIS 7.0 on a computer that is running Windows Vista. Additionally, you configure the Web site to use UNC Passthrough authentication to access a remote Universal Naming Convention (UNC) share.
  • The IIS_IUSRS group does not have the appropriate permissions for the ApplicationHost.config file or for the Web.config file.

Resolution

To resolve this problem, use one of the following methods.

Method 1

Do not configure the Web site to use UNC Passthrough authentication to access the remote UNC share. Instead, specify a user account that has the appropriate permissions to access the remote UNC share.

Method 2

Grant the Read permission to the IIS_IUSRS group for the ApplicationHost.config file or for the Web.config file. To do this, follow these steps:
  1. In Windows Explorer, locate the ApplicationHost.config file that is associated with the Web site, or locate the Web.config file that is associated with the Web site.
  2. Right-click the ApplicationHost.config file, or right-click the Web.config file.
  3. Click Properties.
  4. Click the Security tab, and then click Edit.
  5. Click Add.
  6. In the Enter the object names to select box, type computername\IIS_IUSRS, click Check Names, and then click OK.

    Note Computername is a placeholder for the computer name.
  7. Click to select the Read check box, and then click OK.
  8. In the ApplicationHost.config Properties dialog box or in the Web.config Properties dialog box, click OK.

  • ผลที่ได้จากแก้ปัญหาที่ 1 คือ พบปัญหาที่ 2 ซะงั้น - -'


ปัญหาที่ 2

Server Error in Application "Default Web Site/sample2"
HTTP Error 401.3 - Unauthorized

Description: You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

Error Code: 0x80070005


วิธีแก้ปัญหา 2 ตั้งค่า authen ของ vitual host นั้นซักหน่อย

1. เข้าไปที่ control panel => administrative tools => Internet Information Services (IIS) Manager
2. คลิกที่ vitual host นั้นก่อนเลย ในที่นี้ vitual host เราชื่อ sample2

3. ดับเบิ้ลคลิกที่ Authentication จากนั้นให้คลิกที่ Anonymous Authentication ทางด้านขวาคลิก Edit...



4. ค่าเริ่มต้นจะเลือกอยู่ที่ Specific user: ให้เราเปลี่ยนไปเลือก Application pool identity

5. วิธีแก้ก็มีแค่เนี๋ย เรา refresh FF เราใหม่

สรุปวิธีแก้ปัญหา
  • ปัญหาที่ 1 เราสามารถแก้ปัญหาโดย เพิ่มสิทธิ์ให้ผู้ใช้ iis_usrs ให้กับ web.config หรือ web folder
  • ปัญหาที่ 2 แก้โดยปรับ anonymous authen ใหม่โดยเปลี่ยนไปเลือก Application pool identity

เพิ่มเติม

  • เราสามารถแก้ปัญหาทั้งสองได้โดย เพิ่มสิทธิ์ให้ผู้ใช้ iis_usrs และ iusr ให้ web root folder นั้นเลย
  • หรือ เพิ่มผู้ใช้ everyone ให้ web root folder นั้นก็น่าจะได้นะ

Note

  • ทำไมอยู่หน้า desktop folder web root (อยู่ drive c) เรา ไม่มีสิทธิ์สำหรับ everyone หว่า
  • พอคัดลอกไปวางในพาธ drive d web root เรามี permission สำหรับ everyone ได้ไงหว่าทั้งที่ยังไม่ได้เพิ่มให้เค้าเลยนะงง เหมือนกัน
  • สรุปวิธีแก้ทั้งสองปัญหา คือ นำ folder ของ web root เราไปวาง drive อื่นที่ให้สิทธิ์ everyone อัตโนมัติ (ในที่นี้นำไปวางบน drive d ไม่มีปัญหาเลย)
  • สำคัญที่สุด คือ อย่าลืมลง Ajax Extensions

Tip

  • FF จะมีปัญหากับการคอนฟิก คือ เราแก้ไข iis แหละ พอ refresh เป็นเหมือนเดิมซะงั้น
  • อันนี้คิดว่าน่าจะเกี่ยวกับแคชของ FF นะ IE ไม่เห็นเป็นนะ refresh ก็จะแสดงค่าตามที่เราคอนฟิกใหม่
  • ลอง refresh ซัก 2 ถึง 3 ครั้งดูก่อน น่าจะแสดงผลจากค่า คอนฟิกใหม่แหละ คิดว่านะ แต่จะให้ชัวร์ก็
  • Tools => Clear Private Data... เลือกให้หมด แล้ว Clear เลย จากนั้นลอง refresh ดูแสดงผลจากค่าคอนฟิกใหม่หรือยัง
  • ถ้า clear แหละ ยังนำผลจากค่าคอนฟิกเดิมมาแสดงให้ลอง stop iis เราแล้ว refresh FF แล้ว start iis อีกรอบ จากนั้น refresh FF ดู ตอนนี้น่าจะโอเคแหละ

Related


References

No comments:

Post a Comment

Popular Posts