Call backend .NET dll from ASP.NET Web api

3

I building client server app.

The business logic is build in C++ /CLI. In the same solution I have ASP.NET Web api project.

For logon i have method in backend. For logon i need to do this

using Back_End;
public IHttpActionResult Logon([FromBody]Logon_Request model)
{
 string Answer = Back_End.Logon(model.Name, model.Password);
}

Back_End is inside of the dll in the same solution.

When I try to call api/logon it retunes me an exception.

{
"Message": "An error has occurred.",
"ExceptionMessage": "Could not load file or assembly 'Back_End, Version=1.0.5676.23091, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)",
"ExceptionType": "System.IO.FileLoadException",
"StackTrace": ".........."
}

Of course, because it is not on IIS server.

Finally my questions:

-But do I need to deploy all my business logic dll on server?

-Will whey work here?

-Is any "better" way to do what I want?

-Maybe I need to sun it as a service and make calls? But it will be API for API.

c#
c++
asp.net
visual-studio
asp.net-web-api
asked on Stack Overflow Jul 17, 2015 by Michail

1 Answer

0

Web.Config File

<compilation debug="true" targetFramework="yourTargetFramework">
      <assemblies>
        <add assembly="yourAssemblyName, Version=yourAssemblyVersion, Culture=neutral, PublicKeyToken=yourPublicKeyToken" />
      </assemblies>
</compilation>

login.aspx page

<%@ Register Assembly="yourAssemblyName, Version=yourAssemblyVersion, Culture=neutral, PublicKeyToken=yourPublicKeyToken" Namespace=".dll Namespace" TagPrefix="name to call the loginUserControl" %>

Ex.

...TagPrefix="rs" %>

<rs:Login/>

answered on Stack Overflow Jul 17, 2015 by Adam

User contributions licensed under CC BY-SA 3.0