I am trying to use the CefSharp.OffScreen(41.0.0) Nuget Package within a WCF Service Application, and I'm getting the following error while trying to run the service from Visual Studio 2013:
Could not load file or assembly 'CefSharp.BrowserSubprocess.Core.DLL'
or one of its dependencies. The specified module could not be found.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'CefSharp.BrowserSubprocess.Core.DLL' or one of its
dependencies. The specified module could not be found.
The mentioned assembly is present in the project's bin folder as well as all the required assemblies listed on CefSharp's Website. If there is in fact another assembly required I haven't figured out what it is.
A few other points worth mentioning:
It is easy to reproduce: Start with VS2013's "WCF Service Application" template simply added the CefSharp.Offscreen Nuget Package.
I build the project in x86.
CefSharp also depends on the Visual Studio C++ 2012 redistributables.
I copied those file into the bin folder but still get the same error.
I tried the solutions in the SO question here, to no avail.
CefSharp works fine when referenced from a Console Application or WPF
Application.
Few points,
IIS cannot access Desktop
So you can't run anything that needs a desktop. Your Console and WPF application has access to Desktop and are called user interactive processes.
CEF needs desktop
Cef will need Window manager to create window, without which it cannot render page. This is the reason, the error is misleading here, as IIS cannot load dependent assemblies which require Desktop interaction unless Allow service to interact with Desktop is selected for IIS process in Windows Services.
Console application is only option with Login
You will have to run your application as console and you will need to login to desktop, allowing IIS to interact with desktop is not a good option and I don't even know what kind of problems it might have.
You can set your server to auto login to some user by modifying registry and set your console application in your startup. So this way everytime server will be restarted, your server will automatically login to specified user and your console app will start. (Windows 8.1 has little difficulty but you will get some solution).
Custom Windows Service with Desktop Access
You can change your application type to Windows Service instead of Console and you can install your windows service that allows access to desktop shown in this article, beware, there are problems that this will work only if somebody is logged on to server.
http://www.codeproject.com/Articles/4891/Interact-With-Desktop-when-Installing-Windows-Serv
PhantomJS headless browser
There is PhantomJS headless browser which you can run in IIS/Windows Service without need to interact with desktop, however you will need to shift your code to JavaScript instead of C#. There are other libraries to manage PhantomJS from your app as well.
According to this link it appears that the solution to this problem is to run the CefSharp code in a [STAThread] thread.
Related
I have an antique application using cefsharp.commons dll and I had to update a small part for the api communication.
The problem is that when I run the application on visual studio it works perfectly but when I publish, it installs but loads a blank screen instead of the usual UI.
I've searched different articles on ways to publish using clickonce and it seems the publish its correct.
I´ve also saw the logs on the event viewer application on windows and I have the following messages
Name of application failing: CefSharp.BrowserSubprocess.exe, version 43.0.0.0 name of failing module: KERNELBASE.dll
also:
Excpetion: System.IO.FileNotFoundException
em CefSharp.BrowserSubprocess.Program.Main(System.String[])
But the enviromment runs the previous version so i dont think my windows is missing any dependencies.
I would really appreciate any help.
best regards.
For some reason my application was not caring the cefsharp files when the clickonce application generates the dlls on the receiving computer.
The solution I had to do was manually add the dlls on the project folder (On the roots, besides having it on the reference added).
it is certainly some bug between generating the deploy dependencies and generating it back on installation.
I have a wpf desktop application (ERP) system
Application is using setup and deployment to create the .exe file
Now, i want to create a window service for my application to do some background check ups , synchronizations with my database etc.
I know how to create a service in.net and how manually to install it following the examples online.
My question is how i can install (or include let's say) this service within my .exe setup.
I don't want the user to be responsible to install the service.
Neither me to login every time someone pc to install the service
Not sure if i misunderstood the purpose of service but i found nothing online related to my question.
You can use Microsoft Visual Studio Installer Projects and include your service/main project at the same time
https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects
While using a native dll dependency on a asp.net web project and debugging in VS2015 with IIS express I'm getting the dreaded:
Could not load file or assembly 'XXX.DLL' or one of its dependencies. The specified module could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'XXX.DLL' or one of its dependencies. The specified module could not be found.
HOWEVER the same dependency works fine in a simple forms app on the same machine - hence I assume all the dependencies and co-dependencies are present
maybe you have some clues, how can this be?
What I already tried:
putting all the potential dependencies in the web project output folder
putting all the potential dependencies in the /system32/ path
putting all the potential dependencies in the /system32/inetsrv and /sysWOW64/inetsrv
installing c++ redistributables (2010, 2012, 2013)
I 'unblocked' the dlls as they "came from another computer" (CASpol)
dependency walker did not give any clear results
process monitor did not give any clear results
some details:
VS2015 Community, running on an Azure VM with Windows Server 2012 (test system), clean install
the app uses CGAL and BOOST libraries (c++).
'Dependency tree' is as follows: C# wrapper references a CLR C++ project which in turn references the native C++ (only this one uses CGAL/Boost);
The C# wrapper is then used in the forms app (works) or the asp.net web app (doesn't work);
Putting Cgal dlls (around 6 files) into the bin output folder was enough to run the forms app.
PS: of course on my 2 dev machines (Win 7, Win 10) the asp.net project works swimmingly - but these contain dedicated installs of the huge c++ references.
PPS: I currently really prefer to use iis express due to external reasons. I have to simulate deploying the app on a clean-ish Win10 laptop, in a dev environment, with minimal external installations
PPPS it seems the win10 dev machine isn't working after all - edit: this was the key clue, see my answer below and Ho do I reference native files in IIS express?
I'm a bit stuck right now, thanks.
Solution: on Win 10 I copied the dll output (\bin folder) into the Program Files (x86)\IIS Express folder (as I am using the 32-bit version).
Apparently, this wasn't needed on Win7 - I will have to investigate why
I found this solution in:
Ho do I reference native files in IIS express?
EDIT: another, more elegant (?) solution is to disable shadow-copying in web.config as in http://faithlife.codes/blog/2013/05/using-native-dlls-from-asp-net-apps/
"The simplest solution I’ve found is to turn off shadow copying, which causes the DLLs to be loaded directly from the bin directory.(...) Just add a hostingEnvironment element to your web.config:"
<configuration>
...
<system.web>
...
<hostingEnvironment shadowCopyBinAssemblies="false" />
I have to create an exe of an website created in asp.net using visual studio 2010.
I don't known whether exe of web application can be created or not, but I want that my application with database will be able to run on another system where visual studio will or will not be there.And my code should not to be visible to the users using that exe or running that project.
How can I achieve it?!
you can't make a exe for web application but you can do one thing to solve your problem
1)make a window project in this project make a code for run iis and open browser with your web application url and make your window application form hide
2) now make exe of your window application project
You cannot create an executable file in asp.net.
All you can do is create a website using visual studio. once done, publish your website. Deploy it to IIS or host it to a paid web hosting company so you can have your domain. Once done, other users can see your beautiful and elegant website.
You don't create exe of a web application. It is hosted on IIS. So first of all you have to publish your website and then you can host it. For more information you can refer to this one:http://msdn.microsoft.com/en-us/library/20yh9f1b%28v=vs.100%29.aspx Or google for more articles.
Posting to an old thread, but I came across this situation and found the solution.
Following footsteps of Spring Boot and other containerized solutions, I believe now Microsoft also has added this feature.
My scenario: Created a basic REST based Web application and built it.
This created Debug and Release folder within \bin within the root directory of Web application.
It also creates an exe file.
You just need the necessary runtime dependencies (like .NetCore 3.1 etc in my case) to run this exe.
I copied the entire Web application folder to a Windows Server 2016. There were some issues initially, however later when I added the required dependencies (dotnet folder which was present in my earlier machine), it worked like a charm.
I have an application that I am attempting to profile with CLRProfiler, written in .NET 4.0 and WPF running on the .NET Framework 4 Client Profile. The application loads a data file shortly after startup, the location to which is in app.config (so it is not selected interactively when the program is running). When the application is launched from Visual Studio or Windows Explorer, everything works fine.
When launching the application from CLRProfiler, however, the application crashes with an UnauthorizedAccessException attempting to load the file.
Attempting to fix the issue, I gave Full Control permissions to said file to myself, Domain Users, and Everyone yet the issue continues. When monitoring Task Manager, the short-lived process shows up has having been launched under my user ID.
Does anyone know how to resolve this issue with CLRProfiler?
Ultimately, this turned out to be a combination of two problems:
Not running as administrator.
The data file referenced above had a path specified in a configuration file, but the path was relative. When CLRProfiler launched the application, the working directory remained that of the profiler instead of being switched to the application under analysis. Since I was running unprivileged, the failure to open the data file was actually manifested as an UnauthorizedException because the application did not have permissions to root around in the folder where the profiler was installed.
After correcting both of these (the first by running as administrator the second by changing the config file to use an absolute path), the issues disappeared.