문제

i have console application in which it will try to access an application installed in IIS (i.e. virtual directory) for getting the db connection information. While doing this in windows xp (IIS 5.1), it is working, but it is not working in windows 7 (IIS 7.5). The console application's Target .Net framework is 2.0, 3.5 (having 5 applications), since, it was developed years ago. Now trying to move from XP to Win 7, but facing some issues with accessing the IIS folder. Please advise to access the virtual directory folder in win 7. Any code example will help a lot.

*Error:*System.Runtime.InteropServices.COMException (0x80070005): Access is denied.

도움이 되었습니까?

해결책

It would be useful to have a look at the piece of code which you are using to access the virtual dir, but before changing the code, check if the problem is due to security permissions. If you are trying to access the physical directory associated with the virtual dir in Windows 7, you might be running your console app without enough privileges. Please try running it with administrative privileges.

After cheking your code, I see that you are using Directory Services to access IIS 7 so please make sure that in that machine you have installed IIS Metabase and IIS 6 configuration compatibility. In Windows 7 you can find it in Control Panel -> Programs -> Programs and Features -> Turn windows features on off, and then go to Internet Information Services –> Web Management Tools –> IIS 6 Management compatibility. You need to enable the check in IIS Metabase and IIS 6 configuration compatibility

Nevertheless, the suggested way to access and administer IIS 7 from code is by using the IIS Management API available through the Microsoft.Web.Administration library. You can take a look at an example showing how to perform this same task you need in the following question:

How to get the IIS virtual dir & web application's physical paths with C# code?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top