Wix 3.7: How to set website to unused port? - iis

I am an intermediate WIX user using WIX 3.7 in VS2012. I have multiple webapps solutions.
For each I have a bootstrapper including an MSI project.
I want each installer to conditionally change the port based on what, if anything is already installed in IIS.
In other words: install to port 80 by default or port 81 if 80 is used, or 82 if 81 is used etc.
I have searched for "WIX conditionally change port" and found the following posts
WiX 3.7 IIS Setup
Wix to Install multiple Applications
..but they don't seem to be quite what I need.
Apologies if the answer is staring me in the face and I'm not seeing it.
Thank you.

The obvious solution would be to iterate over all websites and virtual applications on the host and check their port numbers.
Another possibility would be to loop over all ports starting with 80 and checking if it's available. I think the System.Net.NetworkInformation namespace has some useful objects for this kind of stuff, but I don't have much experience with network-related things, so I can't really help you there.
Alternatively, you could run "netstat -a" to get all active connections and parse the results. Redirecting the output to a temp text file might be easier: "netstat -a > c:\temp\netstat.txt". Keep in mind that netstat is somewhat slow.
Either way, I'd keep the port in a property and modify it when you find an available number.

As noted, this functionality does not exist today but the custom actions could be improved to have such a feature. The WiX toolset is Open Source after all.
It'd be a matter of extending the scasched and scaexec DLLs whose source code can be found in the src\ca\serverca folder.

Related

Winginx Faild to start on Windows 10

I just installed Winginx on fresh Windows 10 and nginx never start.
In log I have found:
CreateFile() "C:\Winginx/temp/nginx.pid" failed (2: The system cannot find the file specified)
Has anyone met with such problem before?
I found my solution by giving up and used WampDeveloper Pro Trial. Their installation goes through a check list of items to see if it will cause any problem. And the main problem that came out is the Host file is read only. Which is caused by many Firewall or Antispyware software. In my case it was Spybot.
I simply disabled the read only on my host file, and ran it again and it worked.
Although I got Winginx to work, it may not only be the host file causing the issue. It could be many more, but my WampDeveloper Pro Trial helped fix things I guess, it even check if there are other services uses Port 80 and 443 and disabled them for example. So now, my Winginx is working, that I can turn on and off and so is my WampDeveloper Pro trial, that I turn on and off. So I simply turn one of them on when I need it.

Installing JavaComm API on Ubuntu

I know this question has been asked several times around the internet, but I have spent about a week trying to solve this problem with little luck.
I am trying to install JavaCommAPI (an archived Java package to allow communication with rs232) on a remote linux Ubuntu 11.0, 32-bit server in order to deploy a web project which I have developed on a local apache server on my windows PC.
The thing that puzzles me is, I am able to get the .war web project to deploy on a local apache server on a separate 32-bit LinuxMint16 PC by correctly placing the javax.comm.properties, comm.jar, and libSerialParallel.so files in their respective places.
I use System.getProperty("java.library.path"); in order to find the correct library path in order to install correct files.
On my LinuxMint16:
javax.comm.properties -- /usr/lib/jvm/java-7-openjdk-i386/jre/lib
comm.jar -- /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext
libSerialParallel.so -- /usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386
....works!
On my remote Ubuntu server I did the exact same for its reported library path
(for example: /usr/local/jdk/jdk1.7.0_45/jre/lib/javax.comm.properties ;
/usr/local/jdk/jdk1.7.0_45/jre/lib/ext/comm.jar ;
/usr/local/jdk/jdk1.7.0_45/jre/lib/i386/libSerialParallel.so)
...fails =(
Things of note: I added the needed apache jars and comm.jar to my libraries in Eclipse using the BuildPath wizard (right click on project --> Build Path-->add external jars) which points to local files on my PC which I obviously cannot use for a remote server which I am only accessing through command line. May this is affecting it somehow?
I tried to get error output (System.err) from the Java Console printed to a separate file for my remote server as that feedback was very helpful in getting all the files sorted on my LinuxMint PC.
PrintStream ps = new PrintStream(pathName);
System.setOut(ps);
System.setErr(ps);
Which again, is oddly working beautifully to print the stream to a local .txt file on my LinuxMintPC but not to the one I designate on my remote ubuntu server.
I am really at a wits end here!! Am I mixing and matching appropriate versions of Systems prohibiting things to run smoothly? I am not sure how to proceed from here, if anyone has any insights I would die of happiness. Thanks
I needed to install OPEN JDK7 on my ubuntu, put files in appropriate library paths (as described above) and now it works.

Liferay With Multiple Server Instances

I'm working with multiple Liferay Projects (different Portal, plugins, user and usergroups etc ) in the same time, and often have to switch between them. This switch requires lots of steps like
Editing the portal-ext.properties (to change the Liferay Database, and edit some custom project-specific properties), and edit 'portal-setup-wizard.properties'
Add/remove portlets themes and hooks from the Eclipse Server instance, sometimes clean the Tomcat's 'data' 'Webapps' and 'work' folder
Go to Liferay's Control-Panel/Server/Plugins Installation and re-index portlets like 'Users and Organizations' or 'Documents and Media'
So, I thought that creating a new Server Instance for each project, with a new tomcat and JRE, would be a nice idea. When I had to switch project, I could just stop the old server and start another. At first, I thought (was adviced actually) that using the same Liferay Plugins SDK (6.1.0), should be ok, as long as the Server instances are the same version.
Practically this doesn't work 100% perfectly. While most of the work is getting done, there are some problems here and there, like a theme not getting deployed propertly, hooks not beeing applied etc. As I understand, there is some [Liferay SDK] - [Liferay Server] binding, and that means that only 1 Server (the first one I created) will fully work.
For example, By investigating the [Liferay SDK folder]/bild.[user name].properties, I can see some properties that are referring to a specific Server/JRE location :
app.server.portal.dir
app.server.lib.global.dir
app.server.deploy.dir
app.server.type
app.server.dir
So, my question is, what should I do to work with multiple Liferay Projects ?
Is the multi-Server practice, a good approach to work with multiple-projects ?
If yes, should I create a different SDK for each Server? Maybe a different Eclipse workspace too ? Or is there some way to use the same SDK
What about working with Servers of different Liferay Version ?
Personally, I set up every project with its own source, tomcat, database, etc. even if it means duplication. These days storage is cheap and makes this possible. Of course your milage may very but I thought I'd share my setup with you.
I have a project directory with all my projects which looks like so:
/projects
/foo-project
/bar-project
/my-project
Inside a project I have
/my-project
/tomcat
/bin
/conf
...
/src
/portal
... my portal source ...
/plugins
... my plugin source ...
/portal-ext.properties
I then setup tomcat to use different ports (8080, 8081, 8082, etc...) so that I can just leave them all running if I have to or want to.
I setup Liferay to use different database for each Liferay instance.
I place the portal-ext.properties as a sibling to the tomcat directory and Liferay will read this file (assuming the default behavior). This offers quick and easy edits as well as figuring out how you've set each project up.
The advantages should be clear. You can just "walk away" from a project and into another without tearing down and setting up. And when you return everything will still be as you left it. Context switching is also quicker and helpful if you want to answer a question about a project you're not yet working on.
Depending on the complexity of each of your projects, multi-instance might not work for you. Hooks and EXTs may conflict with each other and it appears as if this is already the case with your projects.
If you can afford the space (which is not much) this has been the fastest way I have found as a Liferay developer.
If we start working on a new Liferay project in our company, we setup:
a new database schema,
a new, clean Liferay server connected with that schema and
a fresh Eclipse workspace, with
a clean SDK project
Only this way you're sure to have cleanly separate projects. To switch to another project, just shutdown the current Liferay server, startup the new one and switch to the right workspace in Eclipse. This all takes no more than 2 minutes, a lot less than to do all the cleanup actions you have to do if you share workspace and server.
In my opinion, this is the approach of most development teams.
Why mess with all these complications in a single computer? I use Oracle VirtualBox and set up a separate VM for each project. Even though I work on a laptop, it has 8 cores, and I've bumped my memory up to 16GB and set each machine up with 4GB of RAM.
I can have multiple VMs running at once and have set all active projects as home pages in Chrome. Using bridged networking each VM has its own IP address, and they all listen on 8080.
Another benefit is that, although my primary project is being developed using Eclipse Indigo and LR 6.1 CE GA1, I have another using Eclipse Juno, its specific IDE plugin and LR 6.1.1 CE GA2. So it also works as a new version tester.
VirtualBox is free. Memory is cheap. And remember that you can put a VM to sleep without shutting it down. That takes about 10-20 seconds and waking it up again takes 30-60 seconds.
The simplest solution would be :
Create 3 different users, the Liferay SDK's bundle.properties file is separate for each user. So, lets say, if you want to run 3 servers with the same sdk. Create 3 files like
bundle.user1.properties
bundle.user2.properties
bundle.user3.properties
Now, when you want to deploy something for server 1, log in the server using user1 and try to deploy the portlet, this will read bundle.user1.properties and it will deploy the portlet/hook to the specified location.
Hope this will resolve your deployment issue.
Also, when you have 3 users, you can run 3 different servers together in a different user accounts, in this way, they would be secure and apart from admin, nobody can shutdown the same.
Hope this helps!

Running multiple sites at once with WebMatrix 2 without opening it up multiple times

Since I have began using WebMatrix, I have developed many of my organization's web-interface, intranet sites. I am now up to four, almost five sites running all at once for users to connect to, and I am afraid that opening up that many instances of the entire WebMatrix app may result in a waste of the server's resources.
I have been scouring the Internet for a reference to how to run multiple sites with WebMatrix. I haven't exactly come up empty handed, however, I haven't found a solution I like either (even though sources suggest this is entirely possible).
Even though I do know how to run multiple sites at once with WebMatrix (simply open up another instance of WebMatrix) my first question is: Isn't this more resource intensive (for the server using iis-express) then it needs to be? Is it beneficial to turn these sites on via command line over simply opening up several instances of WebMatrix?
Last Question: I found this article here...:
http://forums.asp.net/t/1677533.aspx/1
...where Mike Brind suggests that this can be done by using command-line to browse to the correct iis-express directory (for me: C:\Program Files (x86)\IIS Express) and using the command:
iisexpress /site:EmptySite1
Where EmptySite1 is the name of the site desired to be ran.
I get this error when trying this:
Command Line switches must be preceded by a '-' or '/'...
Any clue how I can run multiple sites at once from command-line, or if I even need to?
(Sorry I am in no way a command line guru, as I'm sure you can, by now, tell)
I am running Windows Server 2008 R2, if that matters.
Thanks for any help!
Since you are running full blown Windows Server 2008, install regular IIS. It can run multiple websites all at once without having any special command lines. Since it runs as a service, IIS will automatically restart if and when the server is rebooted. The downside is that IIS is a bit more complicated to configure than IIS express.

The type or namespace name 'Script' does not exist in the namespace 'System.Web'

I just deployed a website into IIS 7 (about which I am woefully ignorant), and upon trying to build the site, I receive this error. I did a little googleing and I saw an article that said I should put system.web.extensions.dll into the /bin. But, I also saw an article saying not to do that. I tried it anyway, but I just received a different error ('Resource cannot be found').
I am totally clueless as to what else to try
Can you use the "Publish" command in Visual Studio to publish directly to the site? If not, then use that command to publish to a similar site on your machine, then copy it to the customer site.
You should also look into the IIS Web Deployment Tool. It can copy an entire site, including IIS settings and any databases. It will be built into VS2010.
Go to control panel, then programs, turn windows features on or off, scroll down to Microsoft.net framework 3.5.1 expand, make sure both sub options are selected, this might help your issue.

Resources