Monday, March 26, 2012

Web service does not show up while adding web reference

Hi,
If I create a Virtual directory with application name
programmatically it will not show up in the available web
services while adding web reference(Dynamic discovery
fails).

Where as if I create the virtual directory manually it
will shown up while adding web reference.

I have used the following code to create it
programmatically on IIS 5.0

I have checked the property pages of virtual directory
created using both the methods they look same.

Set IIsWebVDirRootObj = GetObject
("IIS://LocalHost/W3SVC/1/Root")
Set IIsWebVDirObj = IIsWebVDirRootObj.Create
("IIsWebVirtualDir", "MySecureAPP")

IIsWebVDirObj.Put "Path", "C:\MySecure"
IIsWebVDirObj.Put "AccessRead", True
IIsWebVDirObj.Put "AccessScript", True
IIsWebVDirObj.Put "AppIsolated",2

IIsWebVDirObj.AppCreate2 1
IIsWebVDirObj.Put "AppFriendlyName", "MySecureAPP"
IIsWebVDirObj.SetInfo

Thanks
KiranJust wondering is this in WSH?
What Language?

"Kiran" <kiranjoseph74@.hotmail.com> wrote in message
news:011501c36807$f4561d90$a401280a@.phx.gbl...
> Hi,
> If I create a Virtual directory with application name
> programmatically it will not show up in the available web
> services while adding web reference(Dynamic discovery
> fails).
> Where as if I create the virtual directory manually it
> will shown up while adding web reference.
> I have used the following code to create it
> programmatically on IIS 5.0
> I have checked the property pages of virtual directory
> created using both the methods they look same.
> Set IIsWebVDirRootObj = GetObject
> ("IIS://LocalHost/W3SVC/1/Root")
> Set IIsWebVDirObj = IIsWebVDirRootObj.Create
> ("IIsWebVirtualDir", "MySecureAPP")
> IIsWebVDirObj.Put "Path", "C:\MySecure"
> IIsWebVDirObj.Put "AccessRead", True
> IIsWebVDirObj.Put "AccessScript", True
> IIsWebVDirObj.Put "AppIsolated",2
> IIsWebVDirObj.AppCreate2 1
> IIsWebVDirObj.Put "AppFriendlyName", "MySecureAPP"
> IIsWebVDirObj.SetInfo
>
> Thanks
> Kiran
This is VbScript that uses ADSI objects.
I have tried with C# too, but the same problem exiits

C# Code
DirectoryEntry IISRoot = new DirectoryEntry("IIS://" +
m_strServer + "/W3SVC/1/Root");
DirectoryEntry newDir =
IISRoot.Children.Add( m_strVDirName, "IIsWebVirtualDir");
newDir.Properties["Path"]
[0] = m_strVDirPath;
newDir.Properties
["AccessFlags"][0] = "513";
newDir.Properties
["AppIsolated"][0] = "2";
//newDir.Properties
["AccessWrite"][0] = "True";
newDir.Properties
["AppFriendlyName"][0] = m_strVDirName;
newDir.Invoke
( "AppCreate", true );
newDir.CommitChanges();

Thanks
Kiran

>--Original Message--
>Just wondering is this in WSH?
>What Language?
>"Kiran" <kiranjoseph74@.hotmail.com> wrote in message
>news:011501c36807$f4561d90$a401280a@.phx.gbl...
>> Hi,
>> If I create a Virtual directory with application name
>> programmatically it will not show up in the available
web
>> services while adding web reference(Dynamic discovery
>> fails).
>>
>> Where as if I create the virtual directory manually it
>> will shown up while adding web reference.
>>
>> I have used the following code to create it
>> programmatically on IIS 5.0
>>
>> I have checked the property pages of virtual directory
>> created using both the methods they look same.
>>
>> Set IIsWebVDirRootObj = GetObject
>> ("IIS://LocalHost/W3SVC/1/Root")
>> Set IIsWebVDirObj = IIsWebVDirRootObj.Create
>> ("IIsWebVirtualDir", "MySecureAPP")
>>
>> IIsWebVDirObj.Put "Path", "C:\MySecure"
>> IIsWebVDirObj.Put "AccessRead", True
>> IIsWebVDirObj.Put "AccessScript", True
>> IIsWebVDirObj.Put "AppIsolated",2
>>
>> IIsWebVDirObj.AppCreate2 1
>> IIsWebVDirObj.Put "AppFriendlyName", "MySecureAPP"
>> IIsWebVDirObj.SetInfo
>>
>>
>>
>> Thanks
>> Kiran
>>
>>
>
>.
Did you have any asmx files in the Virtual folder? Additionally, What did
you mean "Dynamic discovery", "Browse to
Web services on the local machine " in VS.NET 2003?

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/s...ns/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026."

0 comments:

Post a Comment