I’m running in to an error while doing a POC with Octopus Deploy for my company. The error is “ERROR: Get-WebSite : Could not load file or assembly ‘Microsoft.IIS.PowerShell.Framework’”
I found this thread http://help.octopusdeploy.com/discussions/problems/5172-error-using-get-website-in-predeploy-because-of-filenotfoundexception but it’s (1) older and (2) closed. It’s the same message but I’ve tried, to the best of my ability to try the solutions suggested in there. Nothing has worked.
What is the official state of this issue and if it’s still outstanding, what is the official workaround / solution?
OctoDeploy-Log.txt (16 KB)
Thanks for getting in touch! Could you provide some more detail on what you tried and what the results were? A few things you could try:
- Add a variable named
Octopus.Action.PowerShell.ExecuteWithoutProfile with a value of ‘True’ to your project and create a new release and deploy that
- Try deploying the application as a top level web site instead of a child of the default web site
- What is the result when you run the following from powershell directly on the affected machine:
Get-Item "IIS:\Sites\Default Web Site"
- Are you running the tentacle as
Local System or a specific user? Try changing it run as the other kind of account.
Number 1 didn’t seem to have an impact. I added it to my Variables tab on the project (“Project Variables” with no scope).
Number 2 isn’t appropriate for my use case. I’ll try it later if nothing else works.
Number 3 results:
Name ID State Physical Path Bindings
Default Web Site 1 Started %SystemDrive%\inetpub\wwwroot http *:80:
I’m trying number 4 next. Just trying to provide feedback as quickly as possible.
Number four didn’t have an impact; I changed to to the user I remote in to the server as (which is a common user for us) – we manually configurate the server with this user.
No difference. I’ll try your number one now.
You can close this. I’ve figured everything out. I don’t know how, exactly, I fixed the IIS/Powershell script issues but ultimately I was trying to get the Physical path set and this turned out as simple as leaving the field blank.
I don’t know why, but something led me to believe that the package is copied to that path… Ultimately, it’s my mistake but I think the documentation could call attention to the ability to “leave this blank and the package’s path will automatically be set”
The error came back. It seems that the error comes from when trying to update the Existing Web Application. My solution was to write PowerShell that executes just before my IIS Deploy step to delete the app. Then the standard Octodeploy tasks seem to work fine.
Thank you for the update. I’ll raise an issue to update the UI as you suggested. Could you send me a screen shot of how your step is configured?
There is an additional step feature, “Custom install directory” which does allow you to set the path the package is extracted to.
Clarification I was wrong in saying the error is the same to the other ticket (originally referenced). It’s similar but not the same error – it’s pointing to a different object.
I’ll attach logs but it’s pointing to:
I’ve reproduced the issue in a new project with the most straight forward configuration that I know of. Attached are all of the details including logs (success and failure), server “system reports”, tentacle and server logs and screenshots of my configuration.
As you’ll see, the first one succeeded. The web app didn’t exist but the application pool was a re-use.
The second run fail giving the error I’ve come to expect:
Get-Item : Could not load file or assembly
'Microsoft.IIS.PowerShell.Framework' or one of its dependencies. The system
cannot find the file specified.
$site = Get-Item $SitePath -ErrorAction SilentlyContinue
A couple of high level notes:
- The targeted failing Tentacle is Server 2008 R2
- I created a second Web Server with Server 2012 R2 – Fresh install. Seems to work
I’m really at a loss as to what is causing this. Any insight at this point would be appreciated. Furthermore, I’ll gather and send you any information you ask for…
At this point, I suppose it’s a server configuration but I have no idea what…
Please see attached file “OctoSupport.zip”
OctoSupport.zip (249 KB)
Thank you for the extra info. I was still not able to reproduce the problem, however looking further into it, the best solution would be to add a retry around that command.
So, I’ve published a new version of Calamari that has this retry, which you can download. See the GitHub page for instructions on how configure your Octopus Server to use this download.
Calamari is the component that runs the steps and scripts on the targets.
That version of calamari will be bundled with our next release of the server (3.8.6).
This is installed and seems to have resolved the issue. I haven’t been able to do extensive testing yet but my dozen or so tests across my 2008 servers have all worked since installing it. Thank you.