Using Wix 3.10
When installing .NET 4.6 on Windows 8.0, the Microsoft package returns an error since the computer is missing anothger kb by microsoft. That's ok so far, but I want to show this message from the NET-installer in my custom wpf-UI, but I didn't figured out what event will trigger.
In my viewmodel I have the current instance of the BootstrapperApplication and my first approach will not log anything:
internal MainViewModel(BootstrapperApplication model, Action<LogLevel, string> onLoggerAction, (....))
{
this.Model = model;
this.Model.DetectPackageComplete += this.DetectPackageComplete;
this.Model.DetectRelatedBundle += new EventHandler<DetectRelatedBundleEventArgs>(this.Model_DetectRelatedBundle);
this.Model.DetectPriorBundle += new EventHandler<DetectPriorBundleEventArgs>(this.Model_DetectPriorBundle);
this.Model.DetectRelatedMsiPackage += new EventHandler<DetectRelatedMsiPackageEventArgs>(this.Model_DetectRelatedMsiPackage);
this.Model.DetectTargetMsiPackage += new EventHandler<DetectTargetMsiPackageEventArgs>(this.Model_DetectTargetMsiPackage);
this.Model.Error += this.SetupError;
[...]
}
public void SetupError(object sender, ErrorEventArgs args)
{
this.onLoggerAction(LogLevel.Standard, string.Format("Error occured. Message: {0}", args.ErrorMessage));
this.onLoggerAction(LogLevel.Standard, string.Format("Error occured. ErrorCode: {0}", args.ErrorCode));
this.onLoggerAction(LogLevel.Standard, string.Format("Error occured. Type: {0}", args.ErrorType));
this.dispatcher.BeginInvoke((Action)(() => this.ShowErrorView(args)));
}
The log file shows the error:
[07D0:06D4][2016-05-09T09:16:36]i301: Applying execute package: Netfx4FullInternal, action: Install, path: C:\ProgramData\Package Cache\3049A85843EAF65E89E2336D5FE6E85E416797BE\NDP46-KB3045557-x86-x64-AllOS-ENU.exe, arguments: '"C:\ProgramData\Package Cache\3049A85843EAF65E89E2336D5FE6E85E416797BE\NDP46-KB3045557-x86-x64-AllOS-ENU.exe" /passive /norestart'
[07D0:06D4][2016-05-09T09:18:11]e000: Error 0x800713ec: Process returned error: 0x13ec
[07D0:06D4][2016-05-09T09:18:11]e000: Error 0x800713ec: Failed to execute EXE package.
[0928:09AC][2016-05-09T09:18:11]e000: Error 0x800713ec: Failed to configure per-machine EXE package
But how can I handle this error?
You already have the "/norestart" and "/passive" arguments in use, try using the "/log C:\pathtolog\yourlog.log" aswell so you can see what goes wrong.
Before shipping your installer you should have fixed all the errors, not display them all.
Imagine installing something and thousands of errors show up....
Related
I was getting a self referenceing loop error "Self referencing loop detected for property 'ApplicationInstance' with type 'ASP.global_asax'" returned from a PUT call to a web api.
I added this to the web api config:
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.All;
Now I get a different error:
"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8
InnerException":ExceptionMessage":"Error getting value from 'ReadTimeout' on 'System.Web.HttpInputStream'.","ExceptionType":"Newtonsoft.Json.JsonSerializationException","StackTrace":" at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)...
Per suggestion, I added the ".ReferenceLoopHandling.Ignore;" config. This fixesd the loop error, but not the 'can't read value' error.
I am having some trouble finding a cure for this one.
EDIT - Error is gone. I am hesitant to say yet if it is fixed, because I am not yet sure why the error was there in the first place. I made the error leave by changing my Put code in the web api. It was:
[HttpPut]
public IHttpActionResult Put([FromBody]RecipientDTO recipient)
{
try
{
repo.SaveUpdatedRecipient(recipient);
return Ok(this.GetById(recipient.RecipKey));
}
catch (Exception ex)
{
return BadRequest(ex.ToString());
}
}
and is now:
[HttpPut]
public HttpResponseMessage Put([FromBody]RecipientDTO recipient)
{
try
{
repo.SaveUpdatedRecipient(recipient);
return Request.CreateResponse(HttpStatusCode.OK);
}
catch (Exception ex)
{
ex.ToString();
//ValidationMethods.GetDbValidationExceptions(ex);
return Request.CreateResponse(HttpStatusCode.NotFound);
}
}
I am still working on the error handling portion, but at least the error is gone and the data is saved. I will update when I find out more. Any input is welcome.
To solve the issue add the below line of code to WebApiConfig.cs file in your webapi project
config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
I have been working on an issue for the past 2 days.I have tried to debug in every way possible but in vain.
Everything works fine on my local.But on production this fails.
Here is a brief description about the problem.
I have a download button and when I click that button I intend to download a file from a server.
protected void Download_Click(object sender, EventArgs e)
{
Button downloadButton = sender as Button;
string filePath = downloadButton.CommandArgument;
string stuid = Session["browse_files_for_student"].ToString();
string stuUsername = MyHelper.GetUsernameForStudentID(stuid);
MyHelper.LogAccess(User.Identity.Name, StudentUsername.Text, filePath, MyHelper.LogAccessType.Read);
FileInfo file = new FileInfo(filePath);
// Download the file
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" + file.Name);
try
{
Response.TransmitFile(filePath);
}
catch (IOException error)
{
Response.Cookies.Add(new HttpCookie("global_last_error", "The file is in use by another process."));
Response.Redirect("~/Public/KnownError.aspx");
}
Response.End();
}
I see on the Event Viewer that it generates:
TransmitFile failed:FileName:dsdfsfd.doc,Impersonation Enabled:0,Token Valid:1 HRESULT:0x8007052e.
Environment: The website is deployed on a Windows 2000 server.
Any help and comments would be appreciated.
Thank you.
The account under which your application is running (probably IIS pool account) does not have access to the file that you are trying to send. The error code 0x8007052e means:
Error code: (HRESULT) 0x8007052e (2147943726) - Logon failure: unknown user name or bad password.
In the future you can check the error code using for instance cdb command (cdb is a part of the freely available Windows Debugging Tools):
cdb notepad.exe
And then after it has started:
0:000> !error 0x8007052e
Error code: (HRESULT) 0x8007052e (2147943726) - Logon failure: unknown user name or bad password.
Hope it helps :)
I am using watin framwork. I have wrote code ie.Runscript('newnote()'); Its running in my pc IIS success. This code also runnign with client visual studio 2008 with success but failed with client IIS. I have also set all rights in IIS and web folder. also check with IE7 and IE8. We have verfied with SSL certificate.But we can not identify where is problem.
please, help me.
Error: (1) Run script failed. and some time (2)Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Code Like:
string mfnQS='45SDS82'
string noteURL = string.Format ("https://sitename.co.uk/apps/shared/dlg_addnoteform.jsp?{0}&parent_package=cxa&cid=", mfnQS);
ie.GoTo(noteURL);
ie.WaitForComplete(2000);
Thread.Sleep(2000);
objBO.NoteDetails = objBO.NoteDetails;
string sNote = StringUtility.RemoveHtmlTag(objBO.NoteDetails);
TextField notetext = ie.TextField(Find.ById("notetext"));
notetext.WaitUntilExists(2000);
notetext.Value = sNote;
notetext.WaitForComplete();
ie.RunScript("$('iframe').contents().find('html body').html(document.addnote.notetext.value)");
WatiN.Core.Button btnAdd = ie.Button(Find.ByValue("ADD NOTE"));
if (btnAdd.Exists)
{
if (ClsReadOnlyKeyword.IsFinalVersion)
{
ie.RunScript("newnote();");
Thread.Sleep(2000);
isTrue = true;
}
}
I'm using the odata client generator (DataSvcUtil.exe) in a Windows Phone 7 application. Retrieving entities and collections is fine as is updating an existing entity. But when I try to add a new entity, I get a NotSupportedException. Here's my code.
private void Button_Click(object sender, RoutedEventArgs e)
{
Drinks d =new Drink();
d.BarCode = "1234567890";
d.Description = "Test Drink";
d.Quantity = -1;
context.AddToDrinks(d);
context.BeginSaveChanges(SaveChangesOptions.Batch, OnChangesSaved, context);
}
private void OnChangesSaved(IAsyncResult result)
{
Dispatcher.BeginInvoke(() =>
{
try
{
var something = result.AsyncState;
context = result.AsyncState as DrinkTrackerModelContainer;
// Complete the save changes operation and display the response.
ShowSaveResponse("Drink Logged!", context.EndSaveChanges(result));
}
catch (DataServiceRequestException ex)
{
ShowSaveResponse("Error Logging Drink", ex.Response);
}
catch (InvalidOperationException ex)
{
ShowSaveResponse(ex.Message, null);
}
}
);
}
As soon as EndSaveChanges is called, I get the
NotSupportedException.
EDIT: I used fiddler and saw that I was in fact getting a different exception from the service. That exception data was not being shown in the debugger. Once I corrected the actual exception, the insert worked fine.
I think you have first chance exceptions turned on which is causing an internal exception thrown by the client library to surface as an exception. Try turning off First Chance Exceptions in the "Exceptions" menu in VS and running the app.
As you mentioned in your edit, the NotSupportedException was a red herring. I think that when debugging a phone app you will hit the NotSupportedException even if you have cleared the setting to break on unhandled CLR exceptions.
If you continue(F5), you'll hit an actual DataServiceRequestException exception. If it doesn't have enough information to debug it, you can follow the steps in this post to get more detailed information in the exception: http://blogs.msdn.com/b/phaniraj/archive/2008/06/18/debugging-ado-net-data-services.aspx
I ran into the same problem yesterday, and after following the steps in the blog I was able to successfully debug the problem.
I have a Windows installer project which includes a custom action. This custom action uses SMO to configure a databse. The installer project is .Net 4. When executing the custom action, I get the following error:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime
and cannot be loaded in the 4.0 runtime without additional configuration information.
I could run the database update code in a separate executable or rewrite the custom action so SMO is not used but I'd rather keep the code as it is if possible.
I know how to fix this in console and Winforms apps by adding the following to the app.config file.
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
The question is how on earth do I do this or something similar with an installer project? I still get this issue when all the referenced assemblies in the custom action are frame work 2 so it must be caused by the MSI itself which is .net4 according to the Fusion Log Viewer.
In the end I decided to launch a concole app from the installer's custom action to do the necessary updates to the databse. It works well
the code is to call the console app from the installer is :
public enum ReturnCode
{
Error = -1,
Updated = 0,
UpdateNotRequired = 1,
ServerNotAvailable = 2,
DatabaseNotAvailable = 3
}
private int UpdateSchema(string installationPath)
{
const string exeName = #"SchemaUpdater";
string executablePath = Path.Combine(installationPath, exeName);
LogModule.Log_NewLogEntry("Starting Schema Updater");
var myProcessStartInfo = new ProcessStartInfo(executablePath);
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.CreateNoWindow = true;
Process process = Process.Start(myProcessStartInfo);
process.WaitForExit();
int exitCode = process.ExitCode;
LogModule.Log_NewLogEntry(string.Format("SchemaUpdate returned {0}", exitCode));
return exitCode;
}
public override void Install(IDictionary stateSaver)
{
string installationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
int dbUpdaterReturnVal = UpdateSchema(installationPath);
if (dbUpdaterReturnVal < 0)
{
throw new Exception("Schema Update returned with an error");
}
if (dbUpdaterReturnVal == (int)ReturnCode.ServerNotAvailable)
{
throw new Exception("SqlServer Not available. Aborting Install");
}
base.Install(stateSaver);
}