How can I deploy my web application war, which have many dependencies in WSO2 AS 5.2.1 - wso2-as

I am trying to upload my web application.war to wso2 as 5.2.1 and when I did that, it displayed in the console the following error message. How can I fix it?
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://584.fwk29855494:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/dausbel/Documentos/WSO3/wso2as-5.2.1/repository/deployment/server/webapps/news-desktop/WEB-INF/lib/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

Related

.net 5 dynamically loading a DLL and all dependencies

I have a .Net 5 worker service that dynamically loads a DLL at runtime and calls a method to setup additional dependency injection.
Activator.CreateInstance(helperClass) as IDependencyInjectionHelper
helper.SetupInjection(hostContext, services);
This works fine for simple implementations, but now I have library that needs EntityFramework. My worker service does not have a refence to entity framework and throws this error at runtime:
Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
If I add EntityFrameworkCore to my worker service everything works, but the reason for loading libraries dynamically is that I don't know everything that is needed in the future.
I also tried to implement this by following this tutorial. When the code calls assembly.GetTypes(), it throws an exception:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or
more of the requested types. Method 'SetupInjection' in type
'TestDatabaseConsumer.InjectionHelper' from assembly
'TestDatabaseConsumer, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' does not have an implementation.'
The exception says my class does not implement my interface, but it does.
I've also tried an MEF but it throws the same exception as above.
How can I load these dependent libraries at runtime?

How to deploy web application to sub directory on MVC site

When I deploy web application to sub directory on MVC site, i got this error.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
How to resolve this problem ?
In my IIS:
https://ibb.co/jp1iQa
My website with ASP.NET Web Application:
https://ibb.co/dRYV5a
Thank.
I need more information. Are you properly setting up a virtual host for this subdirectory? Does it work if it is in the root?
Sounds like you have a build issue, or perhaps you are deploying the source code and not the binary files.

ASP .Net WebAPI does not work with Owin when hosted using XSP/Mono

I am trying to run a project (refer solution here) using mono which has ASP .net Web API and Owin components. The project gets built successfully. However when I hit the endpoint http://127.0.0.1:6666/customers I get below error.
System.Web.HttpException
The resource cannot be found.
Description: HTTP 404.The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Details: Requested URL: /customers
Exception stack trace:
at System.Web.StaticFileHandler.ProcessRequest (System.Web.HttpContext context) [0x000a1] in /builddir/build/BUILD/mono-4.4.0/mcs/class/System.Web/System.Web/StaticFileHandler.cs:77
at System.Web.DefaultHttpHandler.BeginProcessRequest (System.Web.HttpContext context, System.AsyncCallback callback, System.Object state) [0x00098] in /builddir/build/BUILD/mono-4.4.0/mcs/class/System.Web/System.Web/DefaultHttpHandler.cs:101
at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00d9c] in /builddir/build/BUILD/mono-4.4.0/mcs/class/System.Web/System.Web/HttpApplication.cs:1335
at System.Web.HttpApplication.Tick () [0x00000] in /builddir/build/BUILD/mono-4.4.0/mcs/class/System.Web/System.Web/HttpApplication.cs:927
However, CustomersController.Get() endpoint was called correctly which means that the framework was able to go to the correct controller. But something BAD happens past the endpoint.
Note: Worth mentioning that normal ASP .Net Web API project (without OWin) works fine. Issue is only when upon OWin integration.
I am using:
Mono JIT compiler version 4.4.0
Monodevelop 5.10
Refer packages.config for versions of Nuget packages
Here is the WebApiConfig.cs
Here is the CustomerController.cs
Here is the Web.config
If you want to give a try please refer/pull the code and import it in monodevelop.
I tried running this solution in windows and it worked fine there.
I am not able to figure out the cause for this behavior. If anyone can provide me with some pointers to fix this it would be very helpful.
If you absolutely need to run your app on XSP then I don’t have a solution for you, sorry. I started reading Mono’s source code of System.Web.HttpApplication to try to understand why the request would be processed by the static file handler but this is an impossible task without stepping over with a debugger.
But if you just need to run your Web API application on Mono, there’s a very simple solution. Since you have converted your app to OWIN, you can use OwinHost.exe (from the OwinHost NuGet package) instead of xsp4.exe to host your app. This worked fine for me with Mono 5.4.1.7 / OwinHost 3.1.0 / Microsoft.AspNet.WebApi 5.2.3 on OS X 10.11.6.
Excerpt from the OwinHost documentation:
Launching OwinHost:
Self-hosting an OWIN application with OwinHost is as simple as running OwinHost.exe from your Web application's project directory. Project directory is defined here as the parent directory of ./bin which contains the application's assemblies as well as the selected server assembly. By default, when running OwinHost.exe with no additional parameters, the host will attempt to locate and load the application's startup class and the OWIN HttpListener server. After constructing the OWIN pipeline with the help of the startup class, it will then begin listening on port 5000. All of these default behaviors can be easily changed using parameters to OwinHost.exe, as described below.
OwinHost Parameters:
There are a variety of ways to customize the default behavior of OwinHost. For example, to select an alternate OWIN-compatible server, run the following:
OwinHost.exe -s <Custom.Server.Assembly>
The full list of options can be seen by running:
OwinHost.exe /?

MS build error BC30560 user control is ambiguous in the namespace 'ASP'

I have a solution with one web site and one web service project. All the source code is located on a network drive and mapped to Y:\Source. I created two deploy projects. When I build the solution I got error BC30560 user control is ambiguous in the namespace 'ASP' for the web site deployment project. I have tried cleaned up framework temporary folder. However a new one will be generated during the build process. How can I fix this problem?
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\test\0f556676\b4aeff97\App_Web_nprlpegg.0.vb(143,0): error BC30560: 'usercontrols_topcontrol_ascx' is ambiguous in the namespace 'ASP'.
Y:\source\test\Login.aspx(11,0): error BC30560: 'usercontrols_topcontrol_ascx' is ambiguous in the namespace 'ASP'.

The type initializer for 'DevExpress.XtraReports.UI.XtraReport' threw an exception

I'm developing a website in which I need to show docked reports
With .Net framework 3.5 its working fine but when upgraded to framework 4.0 I'm getting the following error in the code.
The type initializer for 'DevExpress.XtraReports.UI.XtraReport' threw an exception.
and in the browser, I'm getting an error as
This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.
Please let me know how to solve this issue.
Thanks
I solved the issue by adding following element in web.config file under system.web tag
<trust legacyCasModel="true"/>
reference link
http://blogs.rev-net.com/ddewinter/2010/03/02/tip-20-opting-out-of-security-changes-in-net-4-in-asp-net-and-custom-appdomains/

Resources