SSIS File System Task moving file to another folder using UNC Path - ssis-2012

In my new SSIS package I have tried using both File System task and Script task to move a file to child ("DONE") folder once the file has been processed and I get an error saying "Could not find part of the path" I set the path to variable 100% the path exists so what I am doing wrong.
The file is being processed by a batchfile that loads the file thru a 3rd party system into an SQL server database. If the file was locked it would surely say locking error and the 3rd party system would not show successful import.

I just fiddled around with my package tried to run it locally but disabled the batch call, (this was running the script so one line call File.Move (Source, Destination) where I changed the destination to not include the filename so the path only) and initially it was circling in an infinite loop. So I stopped it and ran a few more times and every time post the first run it was throwing a Target of Invocation error whatever that is. Then I changed it back to File System Task and now it worked locally. I deployed to the server it worked also. I reenabled the batch call redeployed and it worked on the server go figure. So I have no idea what I really did for it not to work. Moral of the story step away and come back don't trust yourself and reconfigure.
Now that I can put it down to mostly likely a human error or maybe a bug in SSIS that you do something else as in reconfigure it now starts to work or was it simply removing the filename from the destination path works for File System task only I will never know but I will probably delete this post as I don't think it adds anything useful.

Related

Change in web config results in "Could not find assembly..." error

I've come across an unbelievably stupid situation with my ASP.NET MVC application hosted in IIS 7.5. Here's the case:
I publish the application to the server and test it. It works just fine
I change anything in the web.config file and then undo the change. So it's in its original state
I test the application again but this time I get
Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. error.
Please note this: I just open the web.config file and edit and then immediately undo that edit. It doesn't matter in which line of which section I make edit. (After all, aren't configuration files there to not have to touch the code?)
Now comes more interesting part.
I copy and paste the latest published files to the application folder
test the application: Still get the same error
I republish the application and copy/paste to the folder, EXCEPT FOR THE WEB.CONFIG FILE. So I don't even touch the "damaged" config file.
Test it, voila, it works.
I just don't get it. Do you have any clue about this issue?
The problem was caused by a third party tool called EntityFramework Profiler with which I traced SQL commands issued by Entity Framework. After removing it from the application, the problem disappeared.

How to deploy client-side service WSDLs

I have code using the SysOperationFrameworkService, and after a model-deploy or some other set of circumstances, many users get Function SysOperationDataContractInfo::newParameterInfo has been incorrectly called..
It's unable to be resolved with full-compile, sync, full CIL, deleting XPPIL files, deleting AUC/KTI, usage data, security (they're admin), refreshing caches (server &client), etc. and I have a ticket open with Microsoft and they're struggling.
I've narrowed the issue down to when the service group AxClient located in the AOT at \Service Groups\AxClient WSDL files get deployed to C:\Users\[User]\AppData\Local. Either those files existing there, or something happening when those files get deployed is needed.
Any idea how/what causes these files (AxClient.wsdl, etc) to be created? With a user who happens to be "working", I can close the client, delete all the files, open the client, and no files will exist...then I perform a SysOp process and those files get created during that process. With the non-working user, with same security on the same machine does it, the files don't get created.
I have found that the
"Function SysOperationDataContractInfo::newParameterInfo has been incorrectly called" has been throwed because of a possible bug in the kernel when calling the "dictMethod = new DictMethod(UtilElementType::ClassInstanceMethod, dictClass.id(), methodName);" in the SysOperationServiceController.getServiceOperation() method. In my case the new DictMethod was sometimes unable to get the method parameter from a superclass, causing the _parentMethodParameterName check fail in the SysOperationDataContractInfo.newParameterInfo.
So, I solved the issue just by doing an override of the super method where the parameter could not be retrieved and then just calling super(_parameter), then everything went well.
Have you tried axclicfg.exe -> connections -> refresh

Calling Excel from a Child Powershell script...losing context/session

Ok due to requirements I have a main powershell that calls child powershell scripts using the & command. In two of my child powershell scripts I use Excel object to either read an excel file and/or create an excel file. If I run these files locally run great no problems. If I run them through a scheduler (in this case Tidal Scheduling Tool) I have issues.
Issue 1:
The first child script reads an excel file to get the names of the worksheets then uses the worksheet name to query the excel file using OleDB. The query function is in a utilities module and gives an error that it can not find the file or it is locked by another process. I've killed the excel process and still wasn't allowing me to query from the file. As a test I commented out the portion of the script that reads the file and hard coded the worksheet name and works fine so somehow the child script is not able to release the handle on the COM object/file.
Issue 2:
From a second child script I create an excel spreadsheet. I'm creating a csv file which I then save as xls file. Again works fine when running locally but when I run through scheduler I get an error when attempting to run the following line: [void]$worksheet.QueryTables.item($connector.name).Refresh and the error that I get is:
Exception calling "Refresh" with "0" argument(s): "Excel cannot find the text f
ile to refresh this external data range.
Check to make sure the text file has not been moved or renamed, then try the re
fresh again."
Again I'm calling these children scripts using the & command (i.e. & \scriptpath\script.ps1)
Anyone seen this before and know how I can make this work?
Thanks!
I have resolved this issue. Looks like Tidal scheduler has Agents and some of the agents setup at my client will run my scripts with no problems while others will not create files or lock files with no real errors given. Anyway, sorry I don't have more than that but powershell is working fine. :)

Using the spawn command inside of IDL

I'm very new to IDL (trying to do a POC for someone using it) and I am trying to run an external command. The line of code I have added is this:
spawn, 'C:\Program Files\ITT\IDL\IDL80\products\envi48\save_add\visual.exe'
I thought this was all that was needed to launch an external command. When I run the app, i can use the debugger to step through the code, and when I get to this line and Step over, my executable does not run. I see no messages in the debugger indicating any type of error.
I put the file visual.exe in the directory and can run it by hand with no issues. It just seems to step right over the code without executing it or reporting any error.
You can use the form:
spawn, cmd, result, errResult
to get the any error messages that might be generated from the cmd. In your particular case, I think you need to quote the path to the executable because of the space in the path.
Your usage of the spawn command is correct. Perhaps visual.exe is exiting prematurely
for some reason (for example, maybe the working directory when run via spawn isn't what
your external program is expecting.)
You might try writing a little script that starts visual.exe, then does a pause,
and then spawn the wrapper script instead of visual.exe directly. That might
give you a chance to see any error messages before the DOS window disappears.

Updating EXE file from server…

I need to update my application from a central server.
The application checks always if it is a correct version, against the server installation.
So when it is not, I need it to update itself.
So how can I copy the EXE if it is running? What solution do I have?
I rename the current running exe to MyTempExe.exe, copy the new exe to the correct location (request elevated privileges if necessary) and then run a separate app to restart the main app. On start up I check for MyTempExe.exe delete it if it's there.
The reason I use a separate app for the restart is I don't have a set time frame for the app to close down and need to wait for it to finish whatever it's doing, on shutdown it writes information to disk about its current state that the updated app will use to resume where the old one left off.
I don't know if it's the best solution but it's the one I use.
As you can see by all the answers there is no set way to do this, so I thought I would add the way we have successfully done this.
We never run an application directly from the network.
We run the application from the local machine and have it copy from the network on startup.
We do this using an application launcher. It downloads an XML file that contains CRC and Version Resource Values for the application files. The XML File is created during the deployment process, in a FinalBuilder Script.
The application then compares the XML File to local content, and copies down needed files. Finally we then launch the application in question. This has worked well for deploying an application that serves around 300 local users. Recently we switch from a file copy to an HTTP download as we found problems with remote user disconnecting drives.
We still still build installations (With Innosetup) to get the basic required files deployed.
Package your app with an installer such as Inno. Download and execute the installer. Have the installer search for and kill your app, or instruct the user to close it. The setup will replace your .exe, and if the app can't be killed or the user is non-cooperative, it'll issue a re-start notice.
Download new EXE to TEMP
Create Batch from EXE, content:
taskkill /PID %process id of running EXE%
copy %new EXE% %running EXE%
%EXE%
all values in %...% are placeholders
execute batch from the running EXE
delete batch
I use TMS TWebUpdate myself, for software updates. The advantage is that there a bunch of extra actions you can put into the script, if you need anything other than plain EXE updates.
I have two components at work the application executable itself and a web-service (SOAP) which provides version details and file downloads.
The application calls a method on the SOAP service to ask for the number of files in the project (project is identified by using the application.exename usually).
The soap service gets its info from an INI file, which has entries like:
[ProjectName]
NumberOfFiles=2
File1=myapp.exe;1.0.0.1
File2=mydll.dll;1.0.0.2
You just update this file at the same time as uploading your new files.
The process of updating the application this:
Get number of files available on the web service
For each file, the application asks for the name and version number from the SOAP server.
The application compares this information to its own version info and decides if the file needs updating, building a local list of files that need updating.
For each file that needs updating the application downloads the file to filename.ext.new
Finally, the application renames all filename.ext to filename.ext.old and renames filename.ext.new to filename.ext and then restarts itself. (No real need for an external app to restart your own program).
Note 1, that you may have to ask for elevation to replace files, depending on where you install your files.
Note 2: be kind to your users, think carefully before you force updates on users.
Note 3: You cannot delete a running exe, but you can rename it and then restart the new version.
Edit===
For some reference data files which cannot contain version information resources, you can have entires like File99=MyDataFile;1.1.2011 the 3 elements to the version number indicates to the client that it should check against the file date/stamp.
You could have a separate update executable whose task is to check the server version, download an updated executable if necessary, and then run the local executable.
Or you could have one executable running in two different modes: 1. on startup, check for an update, if there is one, download the executable to a download directory, run it and quit.
2. The new executable would check if it's running from the installation directory, if not, it would copy itself there, overwriting the old version, start the copy from there, and quit.
My way is the other way round: If a new version is online, promt the user to update. If he want's to (or is forced to...) I end the app and start a new exe (updater). this updater loads the update and replaces the old exe (not running). then it starts the new exe. ready. (You can of course replace other files too.) BUT: Using an Installer like InnoSetup gives you more possibilities and doesn't mix up with the regular uninstaller, so it is really better...
You can do this without running another application. Push the updates to the client from the server while running, storing in a temporary directory on the client. When you want to upgrade move all your running files to another temporary directory, move the new files into the original application directory, and just restart the application using the standard executable name on shutdown.
I upgrade client applications running on unattended machines automatically this way.

Resources