Dnu publish, Process cannot access file

When I publish my dnx web application 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 until someone hits the site and then I can no longer post due to file blocking

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 doing iisreset

What is the recommended way to get around this? Post a app_offline.htm

first?

+3


source to share


1 answer


Since this is a UAT box and I might lose my security settings, I added this to my deployment script:



iisreset $targetMachine /restart

where the executor of the script must be the local admin $targetMachine

.

0


source







All Articles