Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Webservice using InstallAware

I have created WCF web service and created setup using InstallAware so that our customer just run the setup and it will deploy web service in IIS. My setup create virtual directory under "Default Website" in IIS. Every thing is work fine, my setup create the virtual directory under "Default Website" and point to the correct path but only it gives error before setup finished. Following is the code which create the virtual directory in IIS.

if Variable SUCCESS not Equals ERROR
    if Variable SUCCESS not Equals CANCEL
      Run Program $SUPPORTDIR$\InsertToken1.bat  (WAIT)
      Get IIS Index for Site "Default Web Site" into DEFAULTWEBSITEINDEXVAR
      Create Virtual Folder "WebService" in IIS Site #$DEFAULTWEBSITEINDEXVAR$, pointing to physical location $WWWROOTDIR$WebService
      Get System Setting IIS Anonymous User Account into INETUSR
      Set Read Permissions on File System Object "$WWWROOTDIR$\WebService" for $INETUSR$
    end
  end

After debugging MSI Code I found that the when following line execute it gives the error

Create Virtual Folder "WebService" in IIS Site #$DEFAULTWEBSITEINDEXVAR$, pointing to physical location $WWWROOTDIR$WebService

It gives following error

enter image description here

like image 924
Rajesh Pandya Avatar asked Jan 02 '18 16:01

Rajesh Pandya


1 Answers

PowerShell command will do the needful. Same like creating FTP using PowerShell command

You can use the "New-WebSite" command to create a WebSite in IIS.

Create FTP using powerShell:

Import-Module WebAdministration

##CREATE FTP SITE AND SET C:\inetpub\ftproot AS HOME DIRECTORY
New-WebFtpSite -Name "FTPTmp" -Port "21" -Force
cmd /c \Windows\System32\inetsrv\appcmd set SITE "FTPTmp" "-virtualDirectoryDefaults.physicalPath:C:\Images"

## Allow SSL connections 
Set-ItemProperty "IIS:\Sites\FTPTmp" -Name ftpServer.security.ssl.controlChannelPolicy -Value 0
Set-ItemProperty "IIS:\Sites\FTPTmp" -Name ftpServer.security.ssl.dataChannelPolicy -Value 0

## Enable Basic Authentication
Set-ItemProperty "IIS:\Sites\FTPTmp" -Name ftpServer.security.authentication.basicAuthentication.enabled -Value $true

## Give Authorization to All Users and grant "read"/"write" privileges
Add-WebConfiguration "/system.ftpServer/security/authorization" -value @{accessType="Allow";roles="";permissions="Read,Write";users="*"} -PSPath IIS:\ -location "FTPTmp"

## Restart the FTP site for all changes to take effect
Restart-WebItem "IIS:\Sites\FTPTmp"

Same like you can create website also.

like image 75
TarakPrajapati Avatar answered Oct 30 '22 16:10

TarakPrajapati