I have a Wix installer to deploy my application in IIS. I want to remove HTTP binding when it deploys.
Below is the cmd command that helps in removing the HTTP binding:
“set site /site.name:"My Project Management" /-bindings.[protocol='http',bindingInformation='*:80:']”
I want the same thing happen via wix custom action.Something like below:
<CustomAction Name="RemoveHttp_Cmd" Schedule="Before" Reference="RemoveHttp" Condition="Installed">
<Definition Property="RemoveHttp" Execute="immediate" Value=""[WindowsFolder]system32\inetsrv\appcmd.exe" set site /name:"My Project Management" /-bindings:"http/*:80:"" />
</CustomAction>
<CustomAction Name="RemoveHttp" Schedule="Before" Reference="CreateAppPool" Condition="Installed">
<Definition BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" />
</CustomAction>
It should ideally remove the binding but actually, it is not.
Please suggest the right way to do.
You might want to look at the IIS Rewrite module. It's been my experience that you can use a bootstrapper to install the module if it isn't present and with just a little bit of XML in your applications web.config set up a rule to rewrite http to https or rewrite it to a not supported page. No installer work beyond making sure the rewrite module is present should be needed.
Related
I don't know what I'm doing wrong, but I almost feel I've tried everything. I can't seem to get the web.config of my project to transform with my web.debug.config changes. I read someplace that transformation only takes place when being published. Then I read that SlowCheetah could handle this, so I installed it into my project. It doesn't make any difference either.
Running VS 2012 Express. I debug using the IIS Express local server that was installed by VS. I run Firefox as my browser.
web.config:
<appSettings>
<add key="SiteUrl" value="http://development.mysite.com/" />
</appSettings>
web.debug.config:
<appSettings>
<add key="SiteUrl" value="http://localhost:4652/"
xdt:Transform="SetAttributes"
xdt:Locator="Match(key)" />
</appSettings>
I've also tried using Replace:
<appSettings>
<add key="SiteUrl" value="http://localhost:4652/"
xdt:Transform="Replace"
xdt:Locator="Match(key)" />
</appSettings>
When running in Debug configuration locally:
string siteurl = ConfigurationManager.AppSettings["SiteUrl"];
Still results in siteurl being http://development.mysite.com/
I've ran Preview Transform by right clicking on the web.debug.config and it shows the transform being made perfectly, but not when I run the web application locally.
Have to admit, I don't see how to configure SlowCheetah. I don't see any way to configure it and I've been thinking maybe it does "something" on its own. :S
Does anyone know how to overcome this or if I might be doing something wrong?
I'd suggest ignoring slow cheetah for the moment because I don't think you need it. I've used it for Windows Forms development, but haven't had a need for web development. Instead use the standard one click web deploy mechanism, and rethink how you use config transforms.
Basically, only utilize transforms when you are publishing, and put your local development settings in your main Web.config instead of a transform.
Then if you have a lab/test/sandbox environment you want to publish to create a solution and project configuration for that environment.
Next right click on the Web.config and click Add Config Transform to add a config transform for the solution configuration you just created.
Let's say you added a "Sandbox" solution configuration. If that's the case then a new file named Web.Sandbox.config will appear in Solution Explorer. Go ahead and update the values in Web.config and Web.Sandbox.config like so.
Web.config:
<appSettings>
<add key="SiteUrl" value="http://localhost:4652/" />
</appSettings>
Web.Sandbox.config:
<appSettings>
<add key="SiteUrl" value="http://sandbox.mysite.com/"
xdt:Transform="SetAttributes"
xdt:Locator="Match(key)" />
</appSettings>
Finally, you need to make a "sandbox.mysite.com" (or whatever your URL really is) publish profile and make sure that its Configuration is Sandbox so that the Web.Sandbox.config transform is used during publish.
Ive been trying a few days to activate the FriendlyService in exo-platfom 3.5.x but have been unsuccessful so far.
In the section:
administration > management
There is a service called Friendly Service which allows eXo to rewrite a request URL to another URL (in a more readable format). However, this service is inactivated.
Can someone tell me how activate it?
1.When starting server, you need to enable the profile 'friendly':
Example: ./start_eXo.sh -Dfriendly
2.When registering FriendlyService, you need to provide parameter enable as true:
<component>
<key>org.exoplatform.services.wcm.friendly.FriendlyService</key>
<jmx-name>exo-service:type=FriendlyService</jmx-name>
<type>org.exoplatform.services.wcm.friendly.impl.FriendlyServiceImpl</type>
<init-params>
<value-param>
<name>enabled</name>
<value>true</value>
</value-param>
</init-params>
</component>
Hope it helps..
I'm using TFS (VS 2010) Build Definitions and XAMLs to build apps to different environments. Now, we need to push these builds to Production servers which require different credentials than what the Build Controller has.
I have been working on implementing the steps found at "Customize Team Build 2010 – Part 9: Impersonate activities (run under other credentials)" from http://www.ewaldhofman.nl/post/2010/05/28/Customize-Team-Build-2010-e28093-Part-9-Impersonate-activities-(run-under-other-credentials).aspx but I cannot figure out how to use the credentials within the XAML file.
So, I have implemented the provided solution, and have made build definitions require the credentials, but how do I implement the credentials code (which appears to be in C#) into the XAML (which is XML)?
Thanks,
Stephanie
I have solved my issue here. I wasn't aware that the activities were coded in C#, although organized through the XML.
You can use a TryCatch activity to wrap the impersonation object and dispose it in the Finally.
The XAML should look like:
<TryCatch>
<TryCatch.Variables>
<Variable x:TypeArguments="bl:Impersonation" Name="Impersonation" />
</TryCatch.Variables>
<TryCatch.Try>
<Sequence>
<mtbwa:WriteBuildMessage Message="Impersonating..." />
<ba:CreateImpersonationContext Credentials="[Credentials]" Result="[Impersonation]" />
<!-- Your activities go here -->
</Sequence>
</TryCatch.Try>
<TryCatch.Finally>
<Sequence>
<ba:DisposeImpersonationContext Impersonation="[Impersonation]" />
<mtbwa:WriteBuildMessage Message="Done with impersonation!" />
</Sequence>
</TryCatch.Finally>
</TryCatch>
I finally have TeamCity setup to build on Source Control changes, and a separate MSBuild task setup to package and deploy to IIS on the staging server using the 'package' target and the generated 'deploy.cmd' script. Everything is perfect in terms of build events, file inclusion/exclusion, etc...
However, I've come across a problem with how the package is being deployed. Whenever I deploy the package to the server, the IIS settings get blown away. For example, I can set cache expiration headers or turn on static compression, and after I deploy my package they will revert to the default values of the server.
Does anyone know how I can get around this? Is there a parameter I can pass or rule I can ignore?
I think what you are running into is different from what you might think.
In IIS 7 when you set the values for properties like you are describing the configuration for that is stored in the web.config for the application, and not applicationHost.config. For example I just created a site and modified those settings, then inside my web.config file the following fragment was dropped in.
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<urlCompression doStaticCompression="false" />
<caching>
<profiles>
<add extension=".aspx" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
</profiles>
</caching>
</system.webServer>
So what is happening when you perform a sync the web.config in your package is overwriting the web.config which has the modified properties in it. What you need to do to configure your application in IIS 7 as you want it, then grab the node from place it in your web.config file. Alternatively if you want you can place it in either web.debug.config or web.release.config if you want to only have that in your web.config when publishing.
More specifically I want to test whether Oracle ODP.Net is installed on a machine. I want to do this by testing for the HKLM\SOFTWARE\ORACLE\ODP.NET registry key.
The actual values used by ODP.Net are stored in HKLM\SOFTWARE\ORACLE\ODP.NET\2.111.6.20 however I assume that this lower level key's name will change as updates are released by Oracle.
I have tried the following which fails, possibly because the (Default) value doesn't really exist or possibly because it is null (I'm not sure exactly how it's represented in the registry).
<Property Id="ORACLE_ODPNET">
<RegistrySearch Id="ODPNET_RegKey" Type="raw" Root="HKLM" Key="SOFTWARE\ORACLE\ODP.NET" Name="(Default)"/>
</Property>
<Condition Message="This setup requires ODP.Net to be installed.">
Installed OR ORACLE_ODPNET
</Condition>
So any of the following would be helpful to me:
A way to search for a registry key
with no values under it.
A way to search for a registry value
using a path containing wildcards
A better way to test for ODP.Net
being installed
OK, so thanks to Sascha's information it seems that the answer is "you can't" using the built-in WiX registry functions.
Now I also wanted this test to happen along with the other launch condition tests which makes it a bit harder. Getting this to work has taken me quite a while although it's fairly simple now I know how, so hopefully this will save someone else the same pain.
First create a property inside your WiX Product:
<Property Id="ODPNETINSTALLED">0</Property>
Next create a custom action to check for the key and set ODPNETINSTALLED to "1" if it exists. I'm not going to go into compiling and adding the custom action to the installer here but it's fairly simple if you use Votive in Visual Studio. The code for my custom action is:
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
namespace WiXCustomAction
{
public class CustomActions
{
[CustomAction]
public static ActionResult CheckOdpNetInstalled(Session xiSession)
{
xiSession.Log("Begin CheckOdpNetInstalled");
RegistryKey lKey = Registry.LocalMachine.OpenSubKey(#"SOFTWARE\ORACLE\ODP.Net");
xiSession["ODPNETINSTALLED"] = lKey == null ? "0" : "1";
return ActionResult.Success;
}
}
}
Now you need to register and schedule the action, because I wanted the warning to appear along with my other launch conditions I had to add it to the InstallUISequence element:
<Binary Id="WiXCustomAction.dll" SourceFile="$(var.WiXCustomAction.TargetDir)$(var.WiXCustomAction.TargetName).CA.dll" />
<CustomAction Id="CheckOdpNet" BinaryKey="WiXCustomAction.dll" DllEntry="CheckOdpNetInstalled" Execute="immediate" />
<InstallUISequence>
<Custom Action="CheckOdpNet" Before="LaunchConditions">NOT Installed</Custom>
</InstallUISequence>
Finally add a launch condition to check the property:
<Condition Message="!(loc.OracleOdpCondition)">
Installed OR ODPNETINSTALLED="1"
</Condition>
Note that I believe that scheduling in InstallUISequence means the custom action won't be fired during non-UI installs. However, my installer must have UI install so it's not an issue for me.
Simply omit RegistrySearch/#Name to get the "(Default)" value. Unfortunately there's no way that I'm aware of to do a recursive search, you're going to need to pick a "known" registry key that will be stable between releases and base your search from that.
<Property Id="ORACLE_ODPNET">
<RegistrySearch Id="ODPNET_RegKey" Type="raw" Root="HKLM" Key="SOFTWARE\ORACLE\ODP.NET" />
</Property>
<Condition Message="This setup requires ODP.Net to be installed.">
Installed OR ORACLE_ODPNET
</Condition>