Wix setup failing with error 1603 - encryption

I have written a .NET 4 desktop application and when trying to run the Setup.exe I am getting the following error in the log file.
I am using Visual Studio 2012 with Wix 3.7.
MSI (s) (E8:1C) [16:51:54:890]: Invoking remote custom action. DLL: C:\windows\Installer\MSIFECD.tmp, Entrypoint: EncryptConfig
SFXCA: Extracting custom action to temporary directory: C:\windows\Installer\MSIFECD.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action SecureConfig!SecureConfig.CustomActions.EncryptConfig
EncryptConfig: Begin
An error occurred creating the configuration section handler for security: Could not load file or assembly 'Order.Configuration.Net' or one of its dependencies. The system cannot find the file specified. (C:\Program Files (x86)\Orbit Order System\Orbit Order System.exe.config line 6)
CustomAction EncryptConfigurationFile returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 16:51:55: InstallFinalize. Return value 3.
I can confirm that `Order.Configuration.Net.dll' exists in the target folder as does the application config file.
This is the app.config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="backup"
type="OrderConfiguration.BackupConfig, Order.Configuration.Net"/>
<section name="general"
type="OrderConfiguration.GeneralConfig, Order.Configuration.Net"/>
<section name="security"
type="OrderConfiguration.SecurityConfig, Order.Configuration.Net"/>
<-- ** THIS IS LINE 6 **
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<backup configSource="config\backup.config"/>
<general configSource="config\general.config"/>
<security configSource="config\security.config"/>
<connectionStrings>
<clear/>
<add name="OrderDb"
connectionString="Data Source=(local);Initial Catalog=OrbitOrder;
User Id=User;Password=Pass;MultipleActiveResultSets=true;"/>
</connectionStrings>
</configuration>
I also confirm that config\security.config exists in the target folder.
I have spent three hours trying to figure out what the error means as all files actually exist in the target folder. I actually copied the WIX set up from a prior solution that I worked on a year ago and that one works fine without any issues.
The custom action that is failing is trying to encrypt the security configuration section.
I am at a loss to explain why MSI is throwing a 1603 error when there doesn't appear to be anything amiss.

I managed to resolve this after adding the following code to the Wix custom action:
AppDomain.CurrentDomain.AssemblyResolve += ( sender, args ) =>
{
return Assembly.LoadFrom( string.Format( #"{0}Order.Configuration.Net.dll", installFolder ) );
};
This basically says to load the assembly when it encounters a reference that needs resolving.

As per the log, the error is returned by the custom action written by you, so please debug the custom action dll during installation. Easiest method of debugging custom action is to add a message box in the code (begin of custom action) and attach to process in visual studio when the message box is displayed. other way is to use MsiBreak environment variable as described in http://msdn.microsoft.com/en-us/library/aa368264%28v=vs.85%29.aspx

Related

"Could not load type" error trying to install HTTPModule on IIS6 - Web.config error

Two hours of searching Google and Stackoverflow and I've gotten nowhere. This is not related to code-behind, which is why I've had no luck so far.
Here's my problem: I have a legacy website running IIS6 and I need to install an HTTPModule on it to add some processing to any request for a specific file type. I've written the module, copied it over to the application's /bin directory, and added the following to my Web.config:
<system.web>
<httpModules>
<add name="YourModule" type="SecurityModule.SecurityModule" />
</httpModules>
</system.web>
Then I fire up the website and... "Server Error in /MyApplication".
Here is the entirety of what it gives me:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load type 'SecurityModule.SecurityModule'. (D:\Websites\Reports\web.config line 4)
Source Error:
Line 2: <system.web>
Line 3: <httpModules>
-->Line 4: <add name="YourModule" type="SecurityModule.SecurityModule" />
Line 5: </httpModules>
Line 6: </system.web>
Source File: D:\Websites\Reports\web.config Line: 4
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3618
Line 4, where I added an arrow, is red. And that's it! No explanation, no hints on where to go. Just "Could not load type". I have tried all sorts of things to get around this:
Played with the name of the module in case I got it wrong. And the string in the type.
Changed /Bin to /bin
Make sure the module was compiled against the .NET Framework 2.0
Abandoned web.config and tried setting it up as a mapping in IIS 6 (got 404s from that one).
Related to previous, tried making all files of my extension go through the ASP.NET ISAPI module with a wildcard mapping and configuring the module. Brought me full circle back to this error.
Can anyone tell me what's going on here? Or, failing that, can someone point me in a direction? At this point, any direction will do. :) I'm at a complete dead end.
Thanks!
You should use an assembly qualified name.
NamespaceQualifiedTypeName, AssemblyName

ASP.Net wont launch - IIS error because it's not in root?

I have a ASP.Net solution that I have checked out of SVN. I have saved it under c:\inetpub\solution-name\. The file I am trying to launch is in c:\inetpub\solution-name\trunk\project-name\Default.aspx. When I access that via the browser http://localhost/solution-name/trunk/project-name/, I get the following error:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Source Error:
Line 253: </controls>
Line 254: </pages>
Line 255: <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="AspNetSqlRoleProvider">
Line 256: <providers>
Line 257: <clear/>
I think the problem might have something to do with the directory structure of the files. I don't want to change the structure as I need to be able to have multiple solutions under inetpub, etc.
Is there an IIS configuration to fix this?
You need to create a Virtual Directory for each Asp.Net project in IIS. Also if you are on IIS7+ you can right click on folder and click on "Convert to Application". To create a virtual directory you can right-click on the website in IIS, and select "Add Virtual Directory".

asp.net It is an error to use a section registered as allowDefinition='MachineOnly' beyond machine.config

Hey guys i've been trying to upload my website to a remote server, but i keep getting this error. i have changed every 'allowDefinition' to 'Everywhere' in two machine configs, but i did not help. It highlights ' deployment retail="true"/ ' as the problem field. Any help will be appreciated.
Full error description:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineOnly' beyond machine.config.
Source Error:
Line 23: </compilation>
Line 24: <customErrors mode="RemoteOnly"></customErrors>
Line 25: ***<deployment retail="true"/>***
Line 26: <trace mostRecent="true" enabled="true" requestLimit="1000" pageOutput="false" localOnly="true"/>
Line 27: <authentication mode="Forms" />
According to MSDN, the deployment element can ONLY be set at the machine level.
You need to create a virtual directory. In VS, go to project properties and select the Web tab. There, you will find a button to create it. Leave the machine.config files alone unless absolutely necessary.
My fix was that I edited machine.config and deleted allowDefinition attribute from the declaration of deployment element. I don't claim this is the recommended fix. Note that there are more machine.config files for different .Net versions and also for x86 and x64 applications.
I.e.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

ASP.NET website is working in IIS but not in browser

I have deployed my asp.net 2.0 website on IIS, and I tested there by browsing website in IIS and it's working fine.
But I am getting the below error while browsing the website
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'xmlns'.
Source Error:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Previously when we used to create a website in IIS, it worked fine. I have checked the website folder in IIS [ By clicking Property > ASP.NET] and the framwework tageted there is 1.1, and it is in read only mode. If the problem is related to this issue than please let me know how to change it.
In the Property > ASP.NET tab you need to select the 2.0 version in the version combo. If not available, it means that .NET 2.0 is not properly installed with IIS.
I had this exact error message on a machine where I installed .NET 2.0 prior to IIS.
You can fix this by opening a .NET 2.0 SDK Command Prompt, and run
aspnet_regiis.exe -ir
This will register .NET 2.0 in IIS, and you will get it available in the version combo.
NOTE:
An alternative to run it in the SDK command prompt, is to open a standard command window and navigate to the .NET Framework 2.0 installed location and run aspnet_regiis.exe -ir from there.
On my installation this is:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50110>
The error message you're getting is that the attribute xmlns of the element configuration is not recognized. Before anything else, have you tried removing the xmlns attribute?
I've just double checked by looking at a web.config file I have to hand and the start of it looks like this:
<?xml version="1.0"?>
<configuration>
<configSections>
i.e. No xmlns attribute on the configuration element

VS2010 Assembly Load Error

I am getting the following error when I try to build an ASP.NET 4 project in Visual Studio 2010: "Could not load file or assembly 'file:///C:\Dev\project\trunk\bin\Elmah.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)".
I have verified that the dll does, in fact, exist, and is getting copied to the bin folder correctly. I have also tried removing and then re-adding the reference to the project.
The build only fails when I switch the Solution Configuration to "Release". It does not fail when the Solution Configuration is set to "Debug".
The only difference between the two configurations (that I know of) is shown in the following Web.config transform, Web.Release.config:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="SqlServer" connectionString="" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<customErrors mode="On" xdt:Transform="Replace">
<error statusCode="404" redirect="lost.htm" />
<error statusCode="500" redirect="uhoh.htm" />
</customErrors>
</system.web>
</configuration>
I have tried using Fusion Log Viewer to track down the assembly binding issue, but it looks like it is finding and loading the assembly correctly. Here is the log:
*** Assembly Binder Log Entry (6/8/2010 # 10:01:54 AM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\sgen.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = User
LOG: Where-ref bind. Location = C:\Dev\project\trunk\bin\Elmah.dll
LOG: Appbase = file:///c:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/bin/NETFX 4.0 Tools/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = sgen.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Dev/project/trunk/bin/Elmah.dll.
LOG: Assembly download was successful. Attempting setup of file: C:\Dev\project\trunk\bin\Elmah.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Elmah, Version=1.1.11517.0, Culture=neutral, PublicKeyToken=null
LOG: Re-apply policy for where-ref bind.
LOG: Where-ref bind Codebase does not match what is found in default context. Keep the result in LoadFrom context.
LOG: Binding succeeds. Returns assembly from C:\Dev\project\trunk\bin\Elmah.dll.
LOG: Assembly is loaded in LoadFrom load context.
I feel like there is a fundamental lack of understanding on my part as to what exactly is going on here. Any explanation/help is much appreciated!
Could be too late, I've experienced this issue. In my case, I fixed following this instructions I found in a comment (Thanks Thomas!) in this post
In the 'Developer IT' comment talks about do the same in the app.config. Actually must be in other place. Follow the instructions behind.
An even better solution is to "fix" Microsoft's sgen distribution. First find sgen (for example, on my system for .Net 4.0 it is in "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools".) Next, create the file sgen.exe.config with the contents:
<configuration>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>
The point is, adding loadFromRemoteResources set to true in the sgen app config file allows sgen to properly load files from ClearCase volumes. I know. I've run into the same problem and this is how I fixed it.
Note that at some point Microsoft may create the app config file, so if you do this, first check that the file doesn't already exist, and if it does, check if it still needs the setting.
I realise this is a slightly late reply, but I've just experienced and fixed the exact same issue with Elmah in release mode (and as with the OP, debug mode was working fine).
I fixed my issue by modifying the properties for Elmah.dll in Windows Explorer - from the general tab, I had to click Unblock to convince explorer that the file was indeed safe. After that, release mode publishes worked fine.
According to blogs here and here, the cause might be related to an untrusted assembly. If this were the case, I can't imagine why it would work in one configuration and not the other, but it's at least something to look at.
Problem may have multiple causes.
Appears to be exposed when loading mixed-mode assemblies (compiled in "ANY_CPU" and "X86" mode.)
I revised the compile option for my main program to "X86" to match the assumed mode of the component DLLs. The problem went away.
It may have something to do with the order in which the dll files are loaded.

Resources