I have a web app on Azure. It uses .NET Core 3.1. I use two C++ DLL files as dependencies in the app. The first DLL depends or uses the second DLL. When I run the project in Visual Studio locally, there is no issue. When I deploy the app to Azure, it complains only from the second DLL, and it says "unable to load dll or one of its dependencies". As I said the first DLL use the second DLL in its codes by using " [DllImport(#"..\Folder\Second.dll")] ". What do I need to do or add in web app? Why it is working locally anf not on Azure? Any help would be appreciate.
First make sure that your .dll does not need to be registered in the registry on your local computer. Then you can copy and paste your .dll file directly into the scm website for testing. If it can be successful, then it can be supported.
In this way, we only need to add the following code to the .csproj file, and include your .dll file when publishing.
The specified files are included in the release.
If your .dll needs to be registered in the computer registry, then I can tell you clearly that azure web app is not supported because it is a sandbox environment.
But you can publish your application through azure container webapp or virtual machine.
Related Post
DLLImport does not work on Azure App Service Net. 3.1
Related
I am suddenly seeing this error when running my app (published on Azure app service:
Could not load file or assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. at SharePointLibrary.SPClient.GetAllUsers()
at ADVWKSP.Managers.UserManager.GetUsers() in C:\Users\bassie\source\repos\TFS\ADVWKSP\ADVWKSP\Managers\UserManager.cs:line 21
It runs fine on my machine, and it used to run fine after publish but now it just suddenly starts crying about this file missing.
I checked in Kudu and I can only see the SharePoint.Client.Runtime:
Why? How can I ensure that all required libraries are published with the project. Why did this suddenly stop working?
The hosting environment of azure web app contains a standard installation of .Net framework 2.0 to .Net framework 4.5.
If your application referenced assemblies which is not build in .Net framework, you have to "include" them with your deploy package.
Even these are Microsoft assemblies.
Setting the Copy Local property to True for the referenced assembly may fix it.
1.In Solution Explorer find your project's reference to the library.
2.Right click and choose Properties.
3.In the Properties window set Copy Local to True.
As you said, it works locally on IIS Express, please try to deploy your website content manually to Azure via KUDU or FTP client and find out whether it works or not.
Adding the following parameter
/deployonbuild=false
to the msbuild command line fixed the issue.
I faced the similar kind of issue when my app service function version was 3, but function source was targeted function version 4. updating the app service sorted the issue
I'm trying to upload my web app written in ASP.NET WebAPI2 to Azure app services and when doing this I get a
Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0
error.
I've tried out to:
locally switch between SQLServerCE dependencies x86 and x64 (Private/Desktop references), and then upload again,
upload the _bin_dependencies folder as the MVC 5 sample does,
add the "x86" folder with the 32bit libraries inside myapp/bin...
with no success. Locally my app works like a charm. What can I do? I cannot install / configure IIS / edit Regedit in Azure since I'm using the "App Services" thing...
We solved it awhile ago by following this post guidance . That post is also helpful as it lists some of the limitations you may have with SQL Server CE.
Basically, as it does not come with NuGet, you need to set some things up to be sure that this library will come to Azure with your project.
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 a .net solution with a C# project and a C++ project. The C++ project is an automation server (.exe). The C# project references an ActiveX interface produced by the C++ project (.tlb or registered interface on the machine). This works great on a development machine as I am registering the .tlb using regtlibv12.exe in a post build event in the C++ project. On the build machine, this fails because the service that runs the builds does not have rights to update the registry.
Is it typical to have the service that runs automated builds run as an administrator? Is there another preferred way to do this?
I also read that regtlibv12.exe is not always installed. Is there another way that is preferred to register a .tlb?
In a C# project just check if C++ application (automation server) is running and run it if not.
Then automation server (.exe) will register all available CLSID's in a system
I found no other way to register the type library in the build process other than using regtlibv12.exe. I had to make sure the automated build service is an administrator and everything works.
I have created a simple inventory application in WPF. How should I give it to client now ?
One way what I did: I have set my AppPresentation solution as start up project and I can see all the DLLs from other solutions are added in the Debug and Release directory of this solution.
When I copy the Release folder to other drive (from D: to C:) and run the AppPresentation.exe some Error occurs about some DLL missing but I can still see those DLLs in this folder.
However when I copy the debug folder to the other drive and run the application i.e. AppPresentation.exe now I can run the application successfully with complete working.
Can I give this entire Debug folder to the client and expect that it runs perfectly on his machine ? I will ensure .NET 4.0 Framework is installed on that machine (but not Visual Studio ofcourse). Will this work ?
It will work as long as you have the required version of the .NET Framework installed on the client and all the necessary dll's have been included,
Ideally you should look at creating a Visual Studio setup project:
Using a setup project has the following advantages:
All your dll's and other files required for the application to run will be consolidated in one setup file
You can specify prerequsites such as .NET Framework which will prevent installation until all the required components have been installed first.
Users can specify exactly where on disk the application should be installed without manually copying the dlls (as would be the case in your scenario).
This is but a few advantages of using a setup project but hopefully you'll be convinced to give it a try as it is the preferred way of installing Windows applications
P.S If your setup project gets more complex consider looking at Wix