CefBrowser not loading after deployment using wix - chromium-embedded

Hi I am new to CefBrowser .
When executing the solution from visual studio then the browser is working fine.
But after the development phase when i tried to load the Cef browser directly after deployment the browser is not loading .
The difference i found in the development and deployment stage is When running from VS CefSharp.BrowserSubprocess.exe is running in the task manager but its not running after the deployment .
Am i missing anything ? I have copied all the files from the debug folder too .
Arshad

Thanks #amaitland for the help and suggestions.
Issue got solved after Initializing the CEF browser and setting the absolute path for CefSharp.BrowserSubprocess.exe
if (!Cef.IsInitialized)
{
CefSettings cefSettings = new CefSettings();
cefSettings.BrowserSubprocessPath = path; // **Path where the CefSharp.BrowserSubprocess.exe exists**
cefSettings.CachePath = "ChromiumBrowserControlCache";
cefSettings.IgnoreCertificateErrors = true;
Cef.Initialize(cefSettings);
}
Arshad

Related

Websocket connection to 'wss:localhost:60001/w' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR

I just started learning about React.js and I have been noticing in my developer window (F12) some spamming errors.
These were all the steps I did:
Open Visual Studio 2019
Create a project ASP.NET Core with React.js
Choose .Net Core 5.0
Left the option "Configure for HTTPS"
I pressed Play after the project finished loading
Clicked the F12 key and I noticed the errors popping up in the Console
I have gone through a lot of forums where people have posted about this issue but all of them have to do with people setting up their own "WebSocket Handlers". These people are actively working with web socket code. I haven't even learned web sockets yet. I found one website that remarked that I didn't have my script debugging enabled. So I did that but I still see the same error.
I notice in the error log that it points to WebSocketClient.js, line 16. But all that is located in ClientApp->node_modules and I have nothing to do with that directory or anything to do with those files.
My question is this: is the error happening because my visual studio project is not configured properly? If so, how do I fix my project in order to correct this issue? Many thanks in advance.
It's an issue with cra5 aka react-scripts v5:
To solve you need to add a .env file in the same folder where package.json is present.
In .env file put WDS_SOCKET_PORT=0, '0' means that it will dynamically pick whatever port on which local server is running.
Also need to add/uncomment the middleware UseReactDevelopmentServer in Startup.cs file. So it can be used as proxy to node dev server as v5 not using react-web-utils directly.
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
});

UI selenium Test in Azure devops Release

I am trying to create a release pipeline with IIS deployment and after that, there is UI Selenium test project.
Everything is working fine except the file uploader. How to handle file uploader?
VSTS Agent is not allowing to get the file from the project folder.
I tried to put the file in Sharepoint and get the stream from there and try to save in the project directory but still, it is not allowing to save file.
var directory = Assembly.GetAssembly(typeof(HelperClass)).Location;
Console.WriteLine(directory); var newDir =
directory.Replace("\\bin\\Release\\MarloTest.dll", "\\bin\\Release");
Console.WriteLine(newDir);
if (Directory.Exists(newDir)) return newDir;
(var file= new FileStream(newPath, FileMode.Create))
{
var streamFile = stream; streamFile.CopyTo(file);
}
Thanks in Advance
What agents are you using to fire your UI tests from your release pipeline? If its Hosted agent, I doubt it works. Try installing the agent of your own and trigger a release. For running Selenium UI tests, you can refer here.

Cannot GET index.html Azure Linux Web App

We created a Linux Web App in Microsoft Azure. The application is static written with React (html and Javascript).
We copied the code into the wwwroot folder, but the application only showing only hostingstart.html and when we try to get page index.html we have this error:
Cannot GET /index.html
We tried with a sample of Azure in GitHub (https://github.com/Azure-Samples/html-docs-hello-world) but the error is the same.
The url is this: https://consoleadmin.azurewebsites.net/index.html
Last week the application was running correctly.
We forget to do something?
MAY 2020 - You don't have to add any javascript files or config files anywhere. Let me explain.
I was facing this exact same issue and wasted 6 hours trying everything including the most popular answer to this question. While the accepted answer is a nice workaround (but requires more work than just adding the index.js file), there's something a simpler than that.
You see, when you just deploy an Azure Web App (or App Service as it is also called), two things happen:
The web app by default points to opt/startup/hostingstart.html
It also puts a hostingstart.html in home/site/wwwroot
When you deploy your code, it replaces hostingstart.html in home/site/wwwroot but the app is still pointing to opt/startup/hostingstart.html. If you want to verify this, try deleting opt/startup/hostingstart.html file and your web app will throw a "CANNOT GET/" error.
So how to change the default pointer? It's simpler than it looks:
Go to Configuration tab on your web app and add the following code to startup script:
pm2 serve /home/site/wwwroot --no-daemon
If this web app is a client-side single-page-app and you're having issues with routing, then add --spa to the above command as follows:
pm2 serve /home/site/wwwroot --no-daemon --spa
This will tell the web app to serve wwwroot folder. And that's it.
Image for reference:
Screenshot explaination
PS: If you only set the startup script without deploying your code, it will still show the hostingstart.html because by default that file lies in the wwwroot folder.
Ok you are gonna love this. This happened to me today also. Same exact thing.
I am pretty sure the azure team flipped a switch somewhere and we fell through a crack.
I found this obscure answer with no votes and it did the trick (with a little extra finagling)
BONUS! this also fixed my router issues I was having only on the deployed site (not local):
Credit: #stormwild: Default documents not serving on node web app hosted on Azure
From #stormwild's post see here:
https://blogs.msdn.microsoft.com/waws/2017/09/08/things-you-should-know-web-apps-and-linux/#NodeHome
Steps:
Go to your azure portal, select your app service and launch ssh
In ssh terminal, navigate via command line to /home/site/wwwroot
create index.js there with the following code:
var express = require('express');
var server = express();
var options = {
index: 'index.html'
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);
NOTE: Be sure to run npm install --save express also in this folder else your app service will crash on startup
Be sure to restart your app service if it doesn't do so automagically
A workaround, I changed the webapp stack to PHP 7
Another solution would be to add a file called ecoysystem.config.js right next to your index.html file.
module.exports = {
apps: [
{
script: "npx serve -s"
}
]
};
This will tell pm2 to associate all requests to index.html as your app service starts up.
Very helpful information here: https://burkeholland.github.io/posts/static-site-azure/

Pantheon Drupal 7 setup issue with clean url

On my site under admin section node view (node/xxx) is working fine but when I am trying to edit a node (node/xxx/edit) give me following error
ERR_TOO_MANY_REDIRECTS
This issue is only on Pantheon when I do it on my local server it is working fine.
I already checked .htaccess and web.config file. The same configuration is working for me with another setup
Finally i got solution. Actually i installed ThemeKey module and the ThemeKey Debug creating redirection issue on Pantheon only i disabled it and site is working.

enable embedded jetty cache static files like css/js 304

Embedded jetty runs as web server, all css & js files are refreshed with 200 code when web page is refreshed from web browser. Expected code for static files like css/js is 304.
How embedded jetty can be configured to enable static files cache? Java code instead of xml is used for configuration. Thanks in advance!
Embedded server is initialized as below,
Server server = new Server(80);
HandlerCollection handlers = new HandlerCollection();
ResourceHandler srcHandler = new ResourceHandler();
srcHandler.setResourceBase("WebRoot\\assets");
handlers.addHandler(srcHandler);
ServletContextHandler contextHandler = new ServletContextHandler();
contextHandler.addServlet(RouterSevlet.class, "/index");
SessionManager sm = new HashSessionManager();
sm.setMaxInactiveInterval(3600);
contextHandler.setSessionHandler(new SessionHandler(sm));
contextHandler.setInitParameter("cacheControl","max-age=3600,public");
handlers.addHandler(contextHandler);
server.setHandler(handlers);
use WebAppContext can resolve the problem.

Resources