I am able to make this work locally, but when I publish to Azure App Service or to IIS running on Azure VM, it fails. This is what I'm doing.
I have a web application where the user can create script with selenium commands. For example, the user will write this an save as a text file:
script.OpenBrowser("Chrome");
Then save it in a file on the web server. The user can then navigate to that file and press a run button. That will wrap the script with the following:
using System;
using System.IO;
using TeamStorm.Web.Services;
namespace InMemoryApp
{
class Program
{
static void Main(string[] args)
{
TestServices script = new TestServices(); " + fileContent + "
}
}
}
where fileContent is the script previously mentioned. That is passed to a class I call TestRunner that will compile that code at runtime and run the script. I'm capturing info about the run to determine if the test pass or failed and storing that in a dB for reporting results.
I am doing all of this in Visual Studio 2019 on my local dev machine.
Now when I publish this application. Everything works, but the actual running of the test. I am getting the following errors:
Exception has been thrown by the target of an invocation. made changes then starting getting:
error CS0009: Metadata file 'D:\xxxx\xxx\xxx\xxx\xxxx\wwwroot\dependencies\chromedriver.exe' could not be opened -- PE image doesn't contain managed metadata.(1,163): error CS7036: There is no argument given that corresponds to the required formal parameter 'env' of 'TestServices.TestServices(IWebHostEnvironment)'
started passing the IWebHostEnvironment to the method and showing the inner exception and then started getting:
The HTTP request to the remote WebDriver server for URL http://localhost:53204/session timed out after 60 seconds.
I have published to Azure App Service and to a VM running IIS. The later thinking was it runs on my local machine from VS2019. So, try to run on a VM that everyone can get via the web.
Nothing is working past this point. In short I am trying to run Selenium scripts from a web app where the scripts are created and ran at runtime.
Is what I'm doing even possible to do? I have search high and low and can find no answers as to how to do this or how to get pass the errors. Is this possible?
I have been able to publish to my local IIS server and then using ngrok.exe I can connect and have the app run successfully. However, when I publish to azure vm running IIS. I can deploy successfully and the application runs. But when I try to run a script is where it blows up.