View Full Version : Installing ASP.NET 2.0 Web Service
GAllwood
12-08-2005, 07:32 AM
Hi,
If I install a simple web app or web service using IS 11.5 on to a machine that has both .NET 1.1 and .NET 2.0, the virtual directory that is created is mapped to ASP.NET 1.1 (Virtual Directory Properties->ASP.NET tab-> Version). In order for the ASP.NET 2.0 web site to function I have to manually change the version of ASP.NET for this virtual directory.
Is there a way to get IS to change this mapping during install? If a custom action is required then does anyone have any clues as to how the CA should work?
Thanks for your help
Graham
benton
12-08-2005, 12:28 PM
I have just submitted a request to technical support for the same issue. I will post when I receive an answer from them.
Thanks!
Benton Belcher
jhvangent
12-27-2005, 07:09 AM
Anybody?
I'm having the same issue installing a website for 2.0 with 1.1 on the server.
By default it is set to 1.1 and i can't find a way to set it to 2.0 in the installation!
bavanandham
12-29-2005, 11:46 AM
I'm too having the same problem.
any way of installing the ASP 2.0 by creating a virtual directory from file where we can set the option before creating. There is a option of save configuration to a file and create it back in the IIS using the xml file. There must be some sample application from microsoft doing this stuff. please let me know if you find one such script which we can use in our install script app.
Thanks
Bava
Jody_Barford
01-17-2006, 07:45 AM
Hi,
I'm also experiencing this problem. Anyone know what the status is of this now? Are installshield dealing with it?
Also any work arounds for now?
Thanks in advance,
Jody.
bavanandham
01-17-2006, 10:03 AM
Hi,
Yes there is solution ...
i have used some thing like this to map the ASP.NET app to 2.0
regAspnet = WINDIR ^ "\\microsoft.net\\framework\\v1.1.4322\\aspnet_regiis.exe";
nResult = LaunchAppAndWait(regAspnet, " -i", WAIT);
LaunchAppAndWait will not work properly for installscript MSI project..
so i called a vb.exe which call the aspnet_regiis.exe to perform this..
see the below link..
http://community.installshield.com/showthread.php?t=148929&highlight=Aspnet_regiis.exe
But still we need to set the application pool for the ASP.NET manually because 2.0 needs seperate application pool from the 1.1. Please let me know if you have any solution in setting the app pool using script.
Thanks
Bava
Jody_Barford
01-17-2006, 11:00 AM
Hi,
Thanks for your quick reply bavanandham, I'll give that a go now. I have a configuration utility that needs to be run on the server once the installation has been completed so I can make the call to aspnet_regiis.exe from there.
As for the application pools, can't you create a new application pool for the web sites/services that are going to be using .NET 2? I'm going to give it a try now but I'm having to wait 30 mins + for Visual Studio to Build so may have to check it in the morning :-)
Thanks again,
Jody.
bavanandham
01-17-2006, 03:02 PM
Hi Jody,
good.
I got the script for creating a application pool and assigning to the createed virtuatl directory. You have to create a app pool for ASP.NET 2.0 app or assign a already created app pool. refer the following link for the solution.
http://community.installshield.com/showthread.php?t=144944&page=1&pp=5&highlight=IIS+application+pool
Thanks for all in contribution the solution..
Thanks
Bava
davidh
03-14-2006, 02:15 PM
It seems that a few people are asking for this on the communities (ASP .NET 2.0), so I would like to try to add this to the product.
Two (hopefully simple) questions:
1. Is there a way to manually add this in the Windows IIS manager? Is it in the Application mappings dialog?
2. It seems that you are creating application pools with scripting. Is there a reason that you are not using the support for application in the IIS view? If we are missing something please let us know.
bavanandham
03-14-2006, 02:34 PM
>>1. Is there a way to manually add this in the Windows IIS manager? Is it in the Application mappings dialog?
yes you can do it manually in IIS. IIS 6.0 Manager -> Web Sites -> Virtual Folder -> Right click properites -> "Application Pool" Drop down list box -> choose from the list of Application pool avilable
It is not the Application mappings dialog.
>>2. It seems that you are creating application pools with scripting.
The thing is you cannot mix ASP.NET 2.0 application pool with ASP.NET 1.1 application pool. While creating the pool there
is no specification saying this is for 2.0 and not 1.0. If one app already using 1.1 app pool then you cannot use that for 2.0 application. So you have to create a new uncorrupted app pool for ASP.NET 2.0 web site. or use a App pool which is not used by ASP.NET 1.1 web application. Hope this helps.
michaelrenda
03-14-2006, 03:58 PM
I actually had to do the same thing and here are some code snippets of how I did it with Custom Actions and a C++ dll.
Some things to note.
First, I wanted to make sure that I am setting the very latest .NET Framework on the machine, so I read some registry values to get that information.
Second, I don't assume which web server my virtual directory will be installed on. So my Installscript lists all the web servers installed on the machine and asks the user to pick one. Ninety-nine times out of 100 it will be server id "0", but you never now.
Here's the code:
1. Set a Property value to the path to aspnet_regiis.exe & the virtual directory that you are acting upon
#define KEY1 "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP"
// Create a list to hold values returned by RegDBQueryKey.
listSubKeys = ListCreate(STRINGLIST);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
// Get the list of subkeys. - these are the version numbers for the versions of .NET Framework that are installed
nReturn = RegDBQueryKey(KEY1, REGDB_KEYS, listSubKeys );
// Pick the last item in the list - the newest version
ListSetIndex(listSubKeys, LISTLAST);
ListCurrentString(listSubKeys, szVersion);
szPath = WINDIR + "Microsoft.NET\\Framework\\" + szVersion + "\\aspnet_regiis.exe";
// svArg2 holds the necessary parameter which includes the IIS Server ID that the user chose
svArg2 = "W3SVC/" + svServerID + "/ROOT/myVirtualDirectory";
// the property is actually two values separated by a "|"
szPath = szPPath + "|" + svArg2;
MsiSetProperty(ISMSI_HANDLE, "ASPVERSION", szPath);
2. Create a custom action to set the Property value to be passed to your dll.
3. Create a function in your dll to read the property value and execute aspnet_regiis.exe with a /s command line parameter
UINT __stdcall SetASPVersion(MSIHANDLE hInstall)
{
LPCTSTR PropertyName = _T("CustomActionData");
TCHAR *szPropertyBuf;
TCHAR delimiter[] = _T("|");
TCHAR *szValueBuf;
TCHAR execpath[MAX_PATH];
TCHAR arg2[MAX_PATH];
DWORD ncharCount=0;
UINT uiReturn;
int i=0;
// read the property value
uiReturn = MsiGetProperty(hInstall, PropertyName, _T(""), &ncharCount);
szPropertyBuf = (LPTSTR) malloc(++ncharCount);
szValueBuf = (LPTSTR) malloc(ncharCount);
uiReturn = MsiGetProperty(hInstall, PropertyName, szPropertyBuf, &ncharCount);
// tokenize the passed in value into the execution path and the command line argument
szValueBuf = _tcstok(szPropertyBuf, delimiter);
_tcscpy(execpath, szValueBuf);
if ( (szValueBuf = _tcstok(NULL, delimiter)) == NULL)
{
LogError(hInstall, INSTALLMESSAGE_ERROR, MB_OK, MB_ICONERROR, 25001, _T("ASPVersion Value"), _T("Invalid value"));
return 1;
}
_tcscpy(arg2, szValueBuf);
// execute the function
_tspawnl(_P_DETACH, execpath, execpath, _T("/s"), arg2, NULL);
return 0;
}
michaelrenda
03-14-2006, 04:04 PM
Some additional information:
If you run aspnet_regiis with the "/s virtual-dir" command-line parameters, it will set the named virtual directory to use that particular version of .NET.
That way, you can insure that your installed virtual directory will run the version you need without breaking any other ASP.NET apps that might be on the machine.
The code I previously posted will do that within an installation. It will work for IIS 5 or 6.
bavanandham
03-14-2006, 04:13 PM
Hi michaelrenda,
Thats good to know.
Thanks for posting it. How do you created the Application pool and assigned it? can you post the code for that also..
Thanks
Bava
michaelrenda
03-14-2006, 04:31 PM
To create Virtual Directories and Application Pools I use some .vbs scripts that I modified from something I got on the web. I'm sorry, but I've forgotten the original source.
My installation creates a Virtual Directory (called MyApp), sets it to use SSL and creates an application pool. Then I create a subdirectory (MyApp/Customers) and create an application pool for that.
Here is the code to perform 3 custom actions: One function queries the machine for a list of the server ids that are installed on it; another function creates the virtual directory and Application Pools that I need for my install; and the third function deletes them for an uninstall.
Function CreateVirtualDirectory()
On Error Resume Next
' set some path variables
propvalue = Session.Property("CustomActionData")
if propvalue = "0" then
Exit Function
End if
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (propvalue): " & CStr(err.number) & " - " & err.Description
End If
tokenarray = Split(propvalue, "|", -1, 1)
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (Split): " & CStr(err.number) & " - " & err.Description
err = 0
End If
strServerID = CStr(tokenarray(0))
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (array access): " & CStr(err.number) & " - " & err.Description
err = 0
End If
strDirPath = CStr(tokenarray(1))
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (array access 2): " & CStr(err.number) & " - " & err.Description
err = 0
End If
' get the root server object
strObjName = "IIS://localhost/W3SVC/" & strServerID & "/Root"
Set IIsWebVDirRootObj = GetObject(strObjName)
' create the 'MyApp' virtual directory
IIsWebVDirRootObj.Delete "IIsWebVirtualDir", "MyApp"
IIsWebVDirRootObj.SetInfo
err = 0
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir", "MyApp")
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (create MyApp): " & CStr(err.number) & " - " & err.Description
err = 0
End If
' Use the Windows ADSI object "Put" method to
' set some required properties.
IIsWebVDirObj.Put "Path", strDirPath
IIsWebVDirObj.Put "AccessRead", True
IIsWebVDirObj.Put "AccessScript", True
' Use the AppCreate2 method of the IIS ADSI provider to
' create an application on the new virtual directory.
IIsWebVDirObj.AppCreate2 POOLED
IIsWebVDirObj.Put "AppFriendlyName", "MyApp"
IIsWebVDirObj.Put "AuthAnonymous", True
IIsWebVDirObj.Put "AuthNTLM", True
IIsWebVDirObj.Put "AccessSSL128", True
IIsWebVDirObj.Put "AccessSSLRequireCert", False
' create the 'Customers' subdirectory and mark it as an application
Set IIsWebDirObj = IIsWebVDirObj.Create("IIsWebDirectory", "Customers")
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (create Customers): " & CStr(err.number) & " - " & err.Description
err = 0
End If
' Use the Windows ADSI object "SetInfo" method to
' save the data to the metabase.
IIsWebVDirObj.SetInfo
IIsWebDirObj.AppCreate2 POOLED
If err <> 0 Then
MsgBox "CreateVirtualDirectory error (appcreate): " & CStr(err.number) & " - " & err.Description
err = 0
End If
IIsWebDirObj.Put "AppFriendlyName", "Customers"
IIsWebDirObj.Put "AuthAnonymous", True
IIsWebDirObj.Put "AuthNTLM", True
IIsWebDirObj.Put "AccessSSL128", True
IIsWebDirObj.Put "AccessSSLRequireCert", False
IIsWebDirObj.Put "DefaultDoc", "index.aspx"
IIsWebDirObj.SetInfo
If err <> 0 Then
MsgBox " the error is (setinfo): " & CStr(err.number) & " - " & err.Description
err = 0
End If
Function DeleteVirtualDirectory()
On Error Resume Next
set w3svc = GetObject( "IIS://localhost/w3svc" )
dim propValue
for each IIsWebServer in w3svc
if IIsWebServer.Class = "IIsWebServer" then
strObjName = "IIS://localhost/W3SVC/" & IIsWebServer.Name & "/Root"
strDirName = strObjName & "/MyApp/Customers"
Set DirObj = GetObject(strDirName)
If err = 0 Then
DirObj.AppDelete
DirObj.SetInfo
Set DirObj = GetObject(strObjName & "/MyApp")
DirObj.Delete "IIsWebDirectory", "Customers"
DirObj.AppDelete
DirObj.SetInfo
Set DirObj = GetObject(strObjName)
DirObj.Delete "IIsWebVirtualDir", "MyApp"
DirObj.SetInfo
End If
End if
Next
End Function
Function GetServers()
set w3svc = GetObject( "IIS://localhost/w3svc" )
dim propValue
for each IIsWebServer in w3svc
if IIsWebServer.Class = "IIsWebServer" then
bindings = IIsWebServer.ServerBindings
propValue = propValue & IIsWebServer.ServerComment & " (Server ID: " + IIsWebServer.Name + ")|"
' for each bind in bindings
' x = instr(1, bind, "")
' if x = 1 then
' strIP = "ALL"
' else
' strIP = Left(bind, x - 1)
' end if
' y = instrrev(bind, ":")
' if y = Len(bind) then
' strHost = "NA"
' else
' strHost = Right(bind, Len(bind) = y)
' end if
' strPort = Mid(bind, x + 1, y - x - 1)
' propValue = propValue & strIP & "|" & strPort & "|" & strHost &"|"
' next
End if
Next
propValue = left(propValue, len(propValue) - 1)
Session.Property("WEBSERVERS") = propValue
End Function
brunzefb
03-24-2006, 09:18 PM
One solution seems to run the a command line tool called aspnet_regiis, which can be found on XP systems at
c:\windows\Microsoft.NET\Framework\v2.0.50727
running
aspnet_regiis -s W3SVC/1/Root/YourAppName
seems to do the trick. This needs to be done post creating the virtual directory. I have just done this manually, and it seems to do the trick.
You can do this by running a custom action. Alternatively, google "IIS Chameleon"; on CodeProject there is an article how to set the IIS metabase programmatically.
Macrovision should really support this in a better way, the latest released version 11.5 does not have support for this.
Friedrich Brunzema
davidh
03-28-2006, 03:20 PM
We have a work order here, Issue# IOC-000047059, to add the ability to set the ASP version for a web site or directory. It sounds like what you are doing manually here. I was thinking this could be the implementation:
1. Add a field in the IIS view, perhaps on the General tab that contains additional properties, called "ASP.NET Version".
2. The user could enter a value here for the version of ASP they need for that website\virtual directory.
3. At runtime, after creation of the website, we would call aspnet_regiis -s w3svc/1/root/vrootname1 for the appropriate version of the framework. Example, if the user picked version 2.0.50727 as the version of the framework, we would call aspnet_regiis from the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 directory.
Does this cover the Macrovision support that you would be looking for? Also, it appears that most of you are programmatically creating your app pools. I'm still a little unclear about why you aren't using the 'Application Pools' and 'Web Service Extensions' nodes in the IIS view. Can someone give their thoughts? Maybe we are missing something here or perhaps you are just on an earlier version of InstallShield that did not yet have support for this.
bavanandham
03-29-2006, 10:57 AM
Hi Davidh
>>3. At runtime, after creation of the website, we would call aspnet_regiis -s w3svc/1/root/vrootname1
while running the aspnet_regiis command you have to get the website the webapplication it will be installed. Usuall it is the default "w3svc/1/" some time the user may decide to install in non-default website available under the IIS website in that case "w3svc/1/root/vrootname1" will not work. so you need to consider that in running that aspnet_regiis command.
>>I'm still a little unclear about why you aren't using the 'Application Pools'
The thing is you cannot mix ASP.NET 2.0 application pool with ASP.NET 1.1 application pool. If one app already using 1.1 app pool then you cannot use that for 2.0 application. So you have to create a new uncorrupted app pool for ASP.NET 2.0 web site. or use a App pool which is not used by ASP.NET 1.1 web application. Hope this helps.
davidh
03-29-2006, 11:17 AM
Thanks very much for the feedback. Can you think of anything that would prevent you from creating the uncorrupted app pool via the InstallShield IIS view?
bavanandham
03-29-2006, 11:42 AM
Hi Davidh,
sorry i have only install shield version 8 for development.. i think you are saying for latest version... i haven't tried the IIS view there. If we can map the application pool while creating the asp.net 2.0 application then that is good.
Thanks
kmaclean
04-10-2006, 06:35 AM
Hi folks.
I'm new to the discussion, but it looks like David's solution will provide the functionality we're after. Please be sure to be robust enough to deal with different virtual roots, & etc., especially if the user is setting them through properties.
For the record, we just upgraded to 11.5 primarily because of the advertised ASP.NET 2.0 Framework support. From my standpoint as a developer, that meant the ability to set the application from within InstallShield, so this functionality is critical, and I'm pretty disappointed to have to write it myself after having used its "availability" as justification for the expenditure to management.
Thanks to the strong Community support for having solutions available!
nitsev
01-12-2007, 03:09 AM
A question regarding this. Where do you get/set the variable svServerID in this line?
svArg2 = "W3SVC/" + svServerID + "/ROOT/myVirtualDirectory";
AFAIK you cannot determine the id of the site created by installshield without querying the metabase or is there another way?
pFrenchie
01-14-2007, 08:22 PM
It seems that a few people are asking for this on the communities (ASP .NET 2.0), so I would like to try to add this to the product.
2. It seems that you are creating application pools with scripting. Is there a reason that you are not using the support for application in the IIS view? If we are missing something please let us know.
Hello.
I'd like to be able to present the user with a drop down containing a list of the currently available web sites, so that the virtual directories can be created as the user dictates.
Is this currently possible?
Regards,
Paul
nitsev
01-15-2007, 02:19 AM
I'd like to be able to present the user with a drop down containing a list of the currently available web sites, so that the virtual directories can be created as the user dictates.
I believe you have to do this by querying the IIS metabase. You can use ADSI to do that. See the folder inetpub\AdminScript\findweb.vbs and other script in that folde for vb-script examples. You can add a custom actions and use modified versions of those vb-scripts in your project.
gzvinstall
01-16-2007, 09:43 AM
Hi,
In one of the replies to this thread, I saw the following statement:
LaunchAppAndWait will not work properly for installscript MSI project..
so i called a vb.exe which call the aspnet_regiis.exe to perform this..
I am facing the same problem with my InstallScript MSI project. I use LaunchAppAndWait to create Web service extensions but that does not work.
Could you please explain how to use "vb.exe" to get the functionality of LaunchAppAndWait from the InstallScript MSI project?
An immediate response will be ery helpful. This issue is being a holdup for our project.
Thanks!
Juho75
02-14-2007, 04:01 AM
Hello.
I'd like to be able to present the user with a drop down containing a list of the currently available web sites, so that the virtual directories can be created as the user dictates.
Is this currently possible?
Regards,
Paul
Hi.
Yes it is possible.
I just did it in one of my latest package.
U need to use custom action to do this.
Heres script you can use.
Dim objView
Dim objRecord
Dim objW3SVC, objIisWebSite
Dim lngOrder
Set objView = Session.Database.OpenView("select * from ComboBox")
'enumerate webservers on localhost and populate ComboBox table
Set objW3SVC = GetObject("IIS://localhost/W3SVC")
'Value 1 is used for the default web site supplied by you.
'This value is defined in the ComboBox tabel in the msi DB.
lngOrder = 2
For Each objIisWebSite In objW3SVC
If objIisWebSite.Class = "IIsWebServer" Then
If LCase(objIisWebSite.ServerComment) <> "administration web site" Then
'add site name to ComboBox table (which is used by our dialog ComboBox)
Set objRecord = Session.Installer.CreateRecord(4)
'This is the property name that is used in the property field of the combo box.
objRecord.StringData(1) = "COMBO_SELECTED_VALUE"
objRecord.IntegerData(2) = lngOrder 'order
objRecord.StringData(3) = objIisWebSite.Name 'value
objRecord.StringData(4) = objIisWebSite.ServerComment 'text
'now add the record to the table
objView.Modify 7, objRecord '(7 = msiViewModifyInsertTemporary)
lngOrder = lngOrder + 1
End If
End If
Next
objView.Close
1. create combo box. and set "COMBO_SELECTED_VALUE" in its property.
2. Create Custom action where you run that script
3. If you like you can add values to that list with direct editor combo box table.
I hope this helps you.
BR Juho
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.