Base-64 error when trying to execute vNext deployment script - ms-release-management

Release Management 2013 writes "The input is not a valid Base-64 string" error message into the Application Event Log when it tries to execute my Power Shell DSC deployment script. Does anyone know what could be causing this error?
PS DSC Script:
$ConfigData = #{
AllNodes = #(
#{
NodeName = $env:COMPUTERNAME
}
)
}
Configuration WebAppServer
{
Node $AllNodes.NodeName
{
File WebApplicationFiles
{
Ensure = "Present"
Type = "Directory"
Recurse = $true
SourcePath = $applicationPath
DestinationPath = "C:\inetpub\wwwroot\Test"
}
}
}
WebAppServer -ConfigurationData $ConfigData
Error message from the Application Log:
Timestamp: 9/29/2015 5:19:32 PM
Message: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. : \r\n\r\n at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.GetDecryptedValue(String str, String containerName)
at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.DecryptString(String str, String cryptoContainerName, String key, Encryption encryption)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.ReplaceConfigurationVariable(String content, Boolean isHideEncryptedVariable, String value, String token, Boolean isPassword)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.ReplaceConfigurationVariablesImplementation(String content, Boolean isHideEncryptedVariable)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.InstallComponentImplementation(Func`3 replaceConfigurationVariables, IDictionary`2 installers)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.DeployComponent()
Category: General
Priority: -1
EventId: 0
Severity: Error
Title:
Machine: CAE-ATX-TFS01
Application Domain: ReleaseManagementMonitor.exe
Process Id: 1932
Process Name: D:\Program Files (x86)\Microsoft Visual Studio 12.0\Release Management\bin\ReleaseManagementMonitor.exe
Win32 Thread Id: 10148
Thread Name:
Extended Properties:

I've seen this in the past. When you enter the password, make sure the password asterisks (*****) changes in length to a really long value. That's the indication that it properly encrypted the password. I've seen cases where the encryption event doesn't fire for whatever reason.
You can work around it by saving the template, closing it, reopening it, then typing the password again.

Did you migrate your server or restore an older database?
Try re-entering the password (any encrypted value) in the vNext action in the release definition.
Release Management is trying to invoke the powershell action and is failing there, and it has nothing to do with your script. Possibly, the encrypted password field has been encrypted with a different key from what RM has now.

Related

NpgsqlConnection : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

I am getting error 'Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.' when connecting to PostgreSQL db from .net console application. As far as I did R&D and tried different things, I found that it may be because of = in password as other connection string works fine that doesn't have = in password. Is there any way to pass = in password tried sending %3D instead of = but it didn't work. Password is abc=xyz. Issue looks like with Password=abc=xyz, tried changing it to Password=abc%3Dxyz as well. pgcon.Open(); gives this error.
string pgconnectionstring="Server=someserver.azure.com;Username=dev#postgres;Database=dbname;Port=5432;Password=abc=xyz;SSLMode=Require";
using (NpgsqlConnection pgcon = new NpgsqlConnection(pgconnectionstring))
{
pgcon.Open();
}
NpgsqlConnection doesn't have property password to be set from outside, Is there any way to handle = or other special chars or set password differently?
Issue was not because of =, It was because of DB name. Seems like DB name should be case sensitive. The actual db name is Field-Service. And I was setting it like Field-service, s in small which led to the issue. Though exception message led to wrong direction as it gave error connection closed by remote which generally comes in case of wrong password instead should have given something like DB doesn't exists.

Script Component - ODBC exception password incorrect - package validation

I'm trying to insert some rows into Filemaker using Script Component. I followed this article Creating an ODBC Destination with the Script Component
When I edit the script here I set the connection string:
public override void AcquireConnections(object Transaction)
{
string connectionString;
//connectionString = this.Connections.FmConnection.ConnectionString;
odbcConn = new OdbcConnection("uid=someUID;Dsn=FM;pwd=somepassword");
odbcConn.Open();
}
I get the connection string from the this.Connections object and set it to the new OdbcConnection object. This does not work as I keep getting the exception. I tried setting the connection string manually as you can see above. I still get the exception.
In other parts of my package I use the connection manager to Filemaker and it works. Just not in this script component.
The exceptions I'm getting is:
Error at MyPackageName: [Filemaker] Password Incorrect
What is wrong?

Custom logging in Active task SSIS

I am facing two issues in my SSIS package. The SSIS package I have has an active task that formats an excel sheet as per my requirement and saves it as a different file, modified.xlsx. This file is then used in my data flow task to process and upload data to database tables.
This package works perfectly in my local system, but when I created a scheduled job on my SQL server to run this package it fails with the generic error message "Microsoft (R) SQL Server Execute Package Utility Version 11.0.5058.0 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 12:06:55 PM Error: 2016-04-01 12:06:57.06 Code: 0x00000001 Source: Script Task Description: Exception has been thrown by the target of an invocation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 12:06:55 PM Finished: 12:06:57 PM Elapsed: 1.563 seconds. The package execution failed. The step failed."
To get a more detailed error message i tried to set up logging for the active task.
I configured logging to write log entries for events to a CSV file as in the below screen shot.
I enabled logging for package and checked individuals tasks as well. In active tasks, I added Dts.Log("",0,bytes); to keep track of any exception if any also to log each steps.
public partial class ScriptMain:Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
byte[] bytes = new byte[0];
public void Main()
{
LogMessages("");
LogMessages("Update Bug package execution started at :: " + DateTime.Now.ToLongTimeString());
LogMessages("Loading package configuration values to local variables.");
FileName = Convert.ToString(Dts.Variables["User::ExcelFileName"].Value);
SourceFileLocation = Convert.ToString(Dts.Variables["User::SourceFileLoc"].Value);
SourceFileName = Path.Combine(SourceFileLocation, FileName);
saveLoc = Path.Combine(SourceFileLocation, "ModifiedExcel.xlsx");
var excel = new Excel.Application();
var workbook = excel.Workbooks.Open(SourceFileName);
try
{
foreach (Excel.Worksheet tempSheet in workbook.Worksheets)
{
LogMessages("For loop to check sheet names");
if (((Excel.Worksheet)(tempSheet)).Name.Contains("Test"))
{
if (File.Exists(saveLoc))
{
File.Delete(saveLoc);
}
//File.Create(saveLoc);
tempSheet.Select();
workbook.SaveAs(saveLoc);
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(tempSheet);
}
workbook.Save();
workbook.Close();
excel.Quit();
LogMessages("Quit Excel sheet");
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
LogMessages("Release excel objects");
}
catch(Exception ex)
{
LogMessages("Exception: " + ex.InnerException);
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
}
Dts.TaskResult = (int)ScriptResults.Success;
}
#region ScriptResults declaration
/// <summary>
/// This enum provides a convenient shorthand within the scope of this class for setting the
/// result of the script.
///
/// This code was generated automatically.
/// </summary>
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
#region Log messages to package log files/table.
public void LogMessages(string strLogMsg)
{
Dts.Log(strLogMsg, 0, bytes);
}
#endregion
}
But when i run the package the log file is not updated. The log file just contains the following :
Fields: event,computer,operator,source,sourceid,executionid,starttime,endtime,datacode,databytes,message
Can someone please help me understand what I am missing here for logging? Also, what could be the issue for the job to fail in SQL server?
Why is it not logging?
Here's the fun part, as best as I've been able to divine over the years of dealing with SSIS. Dts.Log is pretty useless, at least if you want it to show up in the Logging facility built into SSIS.
Instead, change out your Dts.Log calls to Dts.Events.Fire e.g.
bool fireAgain = false;
Dts.Events.FireInformation(0, "This gest logged", "My long description here", string.Empty, 0, ref fireAgain);
Then, in your Details tab above, ensure that you have checked the OnInformation event (this also presumes you've configured the package to track it all)
Finally, if you don't actually click the button in Providers and Logs tab, it won't log to the table
Why is it not working?
The package isn't working because you're dealing with Excel and the error message specifies you are running in 64 bit mode.
Microsoft (R) SQL Server Execute Package Utility Version 11.0.5058.0 for 64-bit
Unless you've done something to explicitly make 64 bit Excel work on this server, it's not going to work. Instead, in the SQL Agent job, you need to specify that this task runs in 32 bit mode.
See also
Why does my ODBC connection fail when running an SSIS load in Visual Studio but not when running the same package using Execute Package Utility

Create a SQLite database with Monotouch - permission denied

I am trying to create a Sqlite database using Monotouch 3.0.3.4. Everything works fine on the iPhone simulator, but I get the following error on the test iPhone:
DataLayer.CreateDatabase Exception: System.UnauthorizedAccessException: Access to the path "/private/var/mobile/Applications/4B4944BB-EC37-4B0C-980C-1A9B60DACB44/TestApp.app/myDatabase.db3" is denied.
Here is the code I am using:
// creates database and tables if they do not exist.
public void CreateDatabase ()
{
string sql = string.Empty;
string dbFileName = "myDatabase.db3";
try {
if (!File.Exists (dbFileName)) {
// create database
SqliteConnection.CreateFile (dbFileName); //This is where the error occurs
Console.WriteLine ("CreateDatabase: Database created.");
...
}
catch (Exception ex) {
Console.WriteLine ("CreateDatabase Exception: " + ex.ToString ());
}
...
I have also tried specifing the personal folder, but that has no effect. What do I need to do to make sure permissions are correct?
Thanks!
Monotouch 3.0.3.4
That's likely MonoDevelop 3.0.3.4. See About MonoDevelop to get the MonoTouch version.
"/private/var/mobile/Applications/4B4944BB-EC37-4B0C-980C-1A9B60DACB44/TestApp.app/myDatabase.db3"
On devices the applications are signed, so their content can't change (without breaking the signature). As such you're not allowed to change things in the .app directory.
You should create (or copy) the database in the Documents directory and then open the database as read-write.
See the linked article for more details.

Generating RDP file on the fly

I want to create a web application similar to TS Web Access, where I can create rdp files on the fly for Remote Apps configured on the server. Any idea??
We had to do this exact thing.
private void InvokeRDPSign(String fileName, String certificateThumbPrint)
{
Process signingProcess = new Process();
signingProcess.StartInfo.FileName = #"rdpsign.exe";
String arguments = String.Format("/sha1 {0} {1}", certificateThumbPrint, fileName);
signingProcess.StartInfo.Arguments = arguments;
signingProcess.StartInfo.UseShellExecute = false;
signingProcess.StartInfo.RedirectStandardOutput = true;
signingProcess.StartInfo.WorkingDirectory = Environment.SystemDirectory;
signingProcess.Start();
String signingOutput = signingProcess.StandardOutput.ReadToEnd();
signingProcess.WaitForExit();
int exitCode = signingProcess.ExitCode;
//TODO: should we throw an error if the exitcode is not 0
}
Be aware that that the RDPSign.exe is different on each version of windows. You will find that an older version of the utility will ignore newer settings from the signature.
well Having looked at a 'rdp' file this is the contents:
screen mode id:i:2
desktopwidth:i:1280
desktopheight:i:768
session bpp:i:32
winposstr:s:2,3,1430,104,2230,704
compression:i:1
keyboardhook:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
disable full window drag:i:1
allow desktop composition:i:0
allow font smoothing:i:0
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s: [YOUR IP]
audiomode:i:0
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
autoreconnection enabled:i:1
authentication level:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
drivestoredirect:s:
Just create that as a string, seems straightforward.
ps I have no idea what the 'winposstr' parameter is...

Resources