SharePoint 2013 Troubleshooting: The process cannot access the file... because it is being used by another process
Problem
You are performing a migration of a content database from SharePoint 2007 to SharePoint 2013. You've mounted the database to the 2013 farm and then migrate users:
$wa = Get-SPWebApplication https://URL $wa.MigrateUsers($true) $wa.ProvisionGlobally()
You then see the following error appear once the ProvisionGlobally method is executed:
Exception calling "ProvisionGlobally" with "0" argument(s): "The process cannot access the file 'C:\inetpub\wwwroot\wss\VirtualDirectories\domainnamePort]\app_bin\Microsoft.SharePoint.WorkflowServices.ApplicationPages.dll' because it is being used by another process."
Browsing to the site, you experience an HTTP 404 error. You begin troubleshooting.
Troubleshooting
Check status of Windows Server services: all SharePoint and SharePoint-related services are running.
Check status of application pools in IIS: all SharePoint application pools are started.
Check status of sites in IIS: all SharePoint sites are started.
Check status of services on server in Central Administration: Microsoft SharePoint Foundation Web Application is started.
Check critical service account permissions to content database: spFarm, spService, spApp, spAdmin all have appropriate permissions.
Check critical service account local permissions: all are members of local Administrators group.
Check Alternate Access Mappings: all mappings correct.
Check file checkout: default file is not checked out.
Unmount and remount content database: still have issue.
Perform IISRESET: still have issue.
Restart server: still have issue.
Stop and restart Microsoft SharePoint Foundation Web Application service on server: service stopped without issue; however, when attempting to start it, observed this error:
The process cannot access the file 'C:\inetpub\wwwroot\wss\VirtualDirectories\
[DomainnamePort]\app_bin\Microsoft.SharePoint.WorkflowServices.ApplicationPages.dll' because it is being used by another process.Perform Internet search: some postings indicate that perhaps something is locking the port; do port check.
Run netstat -ano: identified single process listening at port 80, and this was the NT Kernel & System.
Perform Internet search: a posting suggested disabling anti-virus.
Disable McAfee On-Access Scan on the web server: successfully browsed to site.
Solution
- When observing an IIS file being locked by a process, in combination with an HTTP 404 error, try disabling anti-virus.
References
- SPWebApplication.ProvisionGlobally method
- IIS Manager Error: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
- SharePoint - 80 "The Process cannot access the file because it is being used by another process"
Notes
- Subsequently restarted McAfee anti-virus without observing any adverse affect on web application operation.