Reputation: 15971
When I publish my dnx web app via dnu publish
to an IIS server, it works fine with a script that looks like this
dnu publish pathToLocalSource --out \\appserver\appuat --configuration DEBUG --no-source --runtime dnx-clr-win-x64.1.0.0-beta6
It works fine that is - until someone hits the website and then I can no longer publish due to a file lock
Microsoft .NET Development Utility CLR-x64-1.0.0-beta6-12256
Executing script 'prepare' in project.json
Copying to output path \\appserver\appuat
Using Package dependency Microsoft.AspNet.Mvc 6.0.0-beta6
Adding NuGet package C:\Users\[username]\.dnx\packages\Microsoft.AspNet.Mvc\6.0.0-
beta6\Microsoft.AspNet.Mvc.6.0.0-beta6.nupkg to \\appserver\appuat\approot\packages
Installing Microsoft.AspNet.Mvc.6.0.0-beta6
System.IO.IOException: The process cannot access the file '\\appserver\appuat\approot\packages\Microsoft.AspNet.Mvc\6.0.0-b
eta6\lib\dnx451\Microsoft.AspNet.Mvc.dll' because it is being used by another pr
ocess.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share)
at Microsoft.Framework.PackageManager.Publish.PublishOperations.ExtractFiles(
ZipArchive archive, String targetPath, Func`2 shouldInclude)
at Microsoft.Framework.PackageManager.NuGetPackageUtils.ExtractPackage(String
targetPath, FileStream stream)
at Microsoft.Framework.PackageManager.NuGetPackageUtils.<>c__DisplayClass0_0.
<<InstallFromStream>b__0>d.MoveNext()
I can solve this by RDP'ing to the server and executing iisreset
What is the recommended way to get around this? Publish an app_offline.htm
first?
Upvotes: 3
Views: 800
Reputation: 15971
app_offline.htm
isn't supported by dnx at this time (issue #141) and has no effect.So since this is a UAT box and I can be loose with security settings, I added this to my deploy script:
iisreset $targetMachine /restart
where the executor of the script needs to be a local admin of $targetMachine
.
Upvotes: 1