How to debug FileSource attribute of Directory in WiX? - directory

I have got a setup project in WiX in Visual Studio 2010 and in .wxs file I've got:
<Directory Id="SOLVERSLOCATION" Name="Solvers" FileSource="$(var.Main.TargetDir)Solvers">
<Component Id="CmpntSolvers" Guid="13C2AB0B-1AC1-4075-AC75-2716FE37F24A">
<CreateFolder/>
</Component>
</Directory>
<Directory Id="PLUGINSLOCATION" Name="Plugins" FileSource="$(var.Main.TargetDir)Plugins">
<Component Id="CmpntPlugins" Guid="6B6BDF54-2A49-444E-8214-C856530D3BEB">
<CreateFolder/>
</Component>
</Directory>
...
<Feature ... >
<ComponentRef Id="CmpntSolvers" />
<ComponentRef Id="CmpntPlugins" />
</Feature ... >
The problem is that whereas content of PLUGINSLOCATION is added allright to the installator the content of SOLVERSLOCATION is not added at all. I'm at loss what's the reason. The only difference in folders is that PLUGINSLOCATION contains only dll files and in SOLVERSLOCATION are dll files, exe file and ini file.
What may be the problem?
Thank you!
EDIT: There's no problem in paths. I've tried absolute paths too and there was no change.

There isn't many documentation about the FileSource attribute, but perhaps the next link helps you.
Bob Arnson’s blog: Choosing-your-payloads
Check for the "Overriding implicit payload directories" sutitle, it talks about the FileSource attribute and the way it's expected to work. But I suggest you readeing the entire post.
Hope it helps.

Related

Access file using HTTP from Wildfly server

I am facing an issue related to file access over HTTP in Wildfly(JBoss).
I am running an application on Wildlfy-9.0.1.Final
In my application there is a link on click, it supposed to open respective file and display its content. But when I click on link it gives me 404-Not found error.
I could see that file exist on same path as given in href in anchor tag. I don't understand what it makes to give 404 Error.
Is there any other settings that I need to enabled in Wildfly to access files over HTTP. If so, please advice.
EDIT:
My path in <handlers> looks like this
path="/usr/local/jboss/server/default/deploy/"
This directory structure is not yet complete as there will be more path appended dynamically at run-time using java code where actual file will reside.
For ex: path="/usr/local/jboss/server/default/deploy/demo/1/filename"
of which /usr/local/jboss/server/default/deploy/ is static path and demo/1/filename is dynamic.
Also in /directory-listing-uri in location some path is dynamic generated at tun time.
For ex:
Assume below is directory-listing-uri
http://[wildfly host]:[port]/{static}/{dynamic}/{dynamic}/{dynamicFileName}.iif
So I am not sure how wildfly will serve my purpose of displaying files.
Please correct if I am incorrect.
To expose a directory for file listing (and download), you could add two configuration elements in your standalone.xml configuration (if you run wildfly as standalone server) like this:
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
...
<server name="default-server">
...
<host name="default-host" alias="localhost">
...
<location name="/directory-listing-uri" handler="directory-listing-handler"/>
...
</host>
...
</server>
...
<handlers>
...
<file name="directory-listing-handler" path="/home/example/..." directory-listing="true"/>
</handlers>
...
</subsystem>
Note: For jboss-cli configuration, you can take a look at this answer
You will then get a nice Directory Listing GUI at this location:
http://[wildfly host]:[port]/directory-listing-uri

IIS Express won't download .coffee files

I just enabled source maps because, sure why not, I'd like to try them out. However, I'm finding that IISExpress will not download .coffee files so it doesn't work.
I'm sure it's a simple web.config modification, I'm just not sure which one. How do I configure it to serve these?
All of IIS Express's configuration is done through the configuration files; in this case you want
C:\Users\[user]\Documents\IISExpress\config\applicationhost.config
In that file, there's a list of all of the static content types that IIS Express knows about and is willing to serve. You just need to add your extension to that list. The list starts about 1/2 down the file, in this XML element:
<staticContent lockAttributes="isDocFooterFileName">
It should be pretty obvious what to do from there: just map.coffee files to the correct mime type.
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
This element is found within the system.webServer element, which is one of the ones that supports delegation to individual web.config files, so you should be able to add a similar XML block to your project's configuration file:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
</staticContent>
</system.webServer>

Command to rebuild applicationHost.config in IIS 7

Is there a way to rebuild the applicationHost.config file in IIS 7 with a Windows command? Or if you can help me fix the issue by modifying this file, that's fine too. When comparing this file to other servers, I'm noticing very important sections that are missing or different after deleting a site and a few application pools.
I am by no means an expert in IIS 7, but I've been using it for 7 years now. I am confident have performed all of the proper steps for a new site configuration and it still gives me this error, "401.1 "You are not authorized to view this page. You do not have permission to view this directory or page using the credentials that you supplied."
C:\Windows\System32\inetsrv\config\applicationHost.config
This happened on a machine where IIS APPPOOL{app pool user} doesn't exist, so we've never used this user, like I normally do when configuring permissions. We did however add proper permissions to IIS_IUSRS (with IUSR in this group) last week, and the site worked fine. We're using Windows Authentication, and all other authentication methods are turned off. No virtual directories. We are using .NET 4.0, Classic, and 32 bit app (under advanced settings).
We had to manually update the host name by doing the following command in "C:\Windows\System32\inetsrv" on the binding because IIS would grey out the host name when the VeriSign SSL certificate was added to the binding.
appcmd set site /site.name:"himc" /+bindings.[protocol='https',bindingInformation='*:443:subdomain.domain.com']
Missing sections on "bad" web server:
1 - exists on "good" box, missing on "bad" box
<customMetadata>
<key path="LM/W3SVC/INFO">
<property id="4012" dataType="String" userType="1" attributes="Inherit" value="NCSA Common Log File Format,Microsoft IIS Log File Format,W3C Extended Log File Format,ODBC Logging" />
<property id="2120" dataType="MultiSZ" userType="1" attributes="None" value="400,0,,,0
" />
</key>
</customMetadata>
2 - exists on "good" box, missing on "bad" box
<asp>
<cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />
</asp>
3 - this section exists on the "good" box, but only 2.0 (first 2 lines) exist on the "bad" box.
<isapiFilters>
<filter name="ASP.Net_2.0.50727.0" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv2.0" />
<filter name="ASP.Net_2.0.50727-64" path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness64,runtimeVersionv2.0" />
<filter name="ASP.Net_2.0_for_V1.1" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv1.1" />
<filter name="ASP.Net_4.0_64bit" path="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv4.0,bitness64" />
<filter name="ASP.Net_4.0_32bit" path="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv4.0,bitness32" />
</isapiFilters>
4 - this section exists on "bad" box, but is missing on the "good" box
<applicationDependencies>
<application name="Active Server Pages" groupId="ASP" />
</applicationDependencies>
5 - ssiExecDisable property is missing on "good" box
<serverSideInclude ssiExecDisable="false" />
6 - section missing on "bad" box
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
Apparently, Microsoft keeps a history of these files in:
C:\inetpub\history\
Do a backup of all config files first!
So apparently, IIS keeps a history of the config files in C:\inetpub\history. So what you need to do is remember the last known date IIS worked fine and then copy the contents of the config file from c:\inetpub\history and replace config files in c:\windows\system32\inetsrv\config.
Good luck!
If you just want to modify currently active applicationHost.config take a look at this article:
Editing Applicationhost.config on 64 bit Win2008
As the article says, for some reason applicationHost.config is visible only using Explorer (which explains why I wasn't seeing file from my custom file manager) and you can edit it without problems using Notepad (again, any other editor and you'll run into problems).
The inetpub history folder saved my butt. I simply restored the two files in the root folder and wallah problem solved.
To install a backup of an older configuration, you can use the command:
c:\windows\system32\inetsrv\appcmd restore backup CFXHISTORY_xxxxxxxx
where CFXHISTORY_xxxxxxxx is a sub folder of C:\inetpub\history\.
Not sure what the command does besides copying files from that folder to the current configuration, but you should probably use it in case it does do something special.
Or you can just copy the file from the backup as explained in https://stackoverflow.com/a/14859645/2279059

How do I enable Directory Browsing for an virtual web directory using wix?

I want to enable "Directory Browsing" for the for the following virtual web directory using WIX.
<iis:WebVirtualDir Id="LogsVirDir" Alias="Logs" Directory="ESGLOGFILES" />
How do I accomplish this using WIX?
Wouldn't a simpler solution be to use the web.config system.webserver property like :
<directoryBrowse enabled="true"/>
Based on my research Wix currently does not have any capability to enable Directory Browsing using the standard set of actions. The one way I have found to do this is using a combination of Wix Custom Actions and IIS's Appcmd.exe. Note this command will create a web.config file if one does not exist.
<CustomAction Id="EnableDirectoryBrowsing"
Execute="deferred"
ExeCommand='[WindowsFolder]system32\inetsrv\APPCMD.EXE set config "ESG Website/logs" /section:directoryBrowse /enabled:true'
Directory="TARGETDIR"
Return="check"
Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="EnableDirectoryBrowsing" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
Im using wix v3.8
try adding ConfigurableDirectory in your Feature
ex: <Feature Id='TestName' Title='Test Web' ConfigurableDirectory='INSTALLDIR' Level='1'>
Use the following code
<Control Id="Browse" Type="PushButton" X="304" Y="210" Width="56" Height="17" Text="!(loc.CustomizeDlgBrowse)">
<Publish Event="SelectionBrowse" Value="BrowseDlg">1</Publish>
</Control>
Take the value of this in the variable you want and use it.

WiX - Permissions for ASP.NET Temp Folder

I'm trying to set the permissions of the temp ASP.NET files folder as follows:
<PropertyRef Id="NETFRAMEWORK20INSTALLROOTDIR"/>
<DirectoryRef Id="NETFRAMEWORK20INSTALLROOTDIR">
<Directory Id="TempASPNETFolder" Name="Temporary ASP.NET Files">
<Component Id="PermissionsTempAspnet" Guid="{C107EC7F-FC97-41b6-B418-EA4532949362}">
<CreateFolder>
<util:PermissionEx GenericAll="yes" User="[WIX_ACCOUNT_NETWORKSERVICE]" />
</CreateFolder>
</Component>
</Directory>
</DirectoryRef>
I've included the netfx and util extensions. When I compile I get the following error:
error LGHT0094: Unresolved reference to symbol 'Directory:NETFRAMEWORK20INSTALLROOTDIR'
What am I missing here?
Update: Not know much about WiX, I tried this. It compiles and links. Not sure it actually works.
<DirectoryRef Id="TARGETDIR">
<Directory Id="NetFramework20InstallDir" Name="[NETFRAMEWORK20INSTALLROOTDIR]">
<Directory Id="TempASPNETFolder" Name="Temporary ASP.NET Files">
<Component Id="PermissionsTempAspnet" Guid="{C107EC7F-FC97-41b6-B418-EA4532949362}">
<CreateFolder>
<util:PermissionEx GenericAll="yes" User="[WIX_ACCOUNT_NETWORKSERVICE]" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</DirectoryRef>
Your second solution will create a directory named "[NETWORKFRAMEWORK20INSTALLROOTDIR]" on the largest drive on you machine. I don't think that is what you want. :)
The solution is to use "NETFRAMEWORK20INSTALLROOTDIR" as the Directory/#Id. This makes sense only after you realize that Directories can be treated like Properties. Not necessarily intuitive but that's what the Windows Installer does nonetheless. So, I'd just change your first example to something like:
<PropertyRef Id="NETFRAMEWORK20INSTALLROOTDIR"/>
<DirectoryRef Id="TARGETDIR">
<Directory Id="NETFRAMEWORK20INSTALLROOTDIR" Name="This will be ignored because the DirectorySearch used by the PropertyRef above will overwrite it.">
<Directory Id="TempASPNETFolder" Name="Temporary ASP.NET Files">
Hopefully, that points you in the right direction. Note, I would use a shorter Directory/#Name than my example above. ;)

Resources