I'm trying to deploy my ASP.NET Core project that runs a selenium instance in headless mode, it works perfectly fine in development but once I deploy to Azure Virtual Machine it keeps giving the following error:
An unhandled exception occurred while processing the request. WebDriverException: Selenium Manager process exited abnormally with -1073740791 code: H:\wwwroot\myinvite.me\selenium-manager/windows/selenium-manager.exe --browser "chrome" --output json
OpenQA.Selenium.SeleniumManager.RunCommand(string fileName, string arguments)
WebDriverException: Error starting process: H:\wwwroot\myinvite.me\selenium-manager/windows/selenium-manager.exe --browser "chrome" --output json OpenQA.Selenium.SeleniumManager.RunCommand(string fileName, string arguments)
NoSuchDriverException: Unable to obtain chrome using Selenium Manager; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location OpenQA.Selenium.DriverFinder.FullPath(DriverOptions options)
P.S: I tried adding permissions as I think this is a permissions error in downloading/writing the chromedriver to the wwwroot (i guess? because i tried running the file manually in powershell administrator and worked perfectly fine) I went to security tab of wwwroot folder and added The app pool, default pool, any thing that I could think - maybe - to the allowed users and gave full permissions.
On your Azure Virtual Machine, check if you can access the selenium documentation link that's given in the error (https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location).
If you are unable to access this link on the VM, then that would mean this error is occurring because that URL is blocked on the VM. The selenium-manager downloads the driver if required while executing the create new driver instance code. And for all those tasks the selenium-manager probably uses similar kind of URL so it needs access to that.
For me, it turned out to be my VPN. I was using VPN to run the code and the region which my VPN was connected to did not allow access to selenium URLs. Once I turned off my VPN, everything started running smoothly.