none
calling dll from WCF Web Service RRS feed

  • Question

  • Hello

    I do have a problem.

    there is a .net dll, wrapping a native dll (works fine). Now I have to create a web service calling the wrapper dll because I have to call function from a 64bit app.

    How can I realize this? I tried something but it seems my service does not communicate with the dll

    Friday, June 7, 2013 9:31 AM

Answers

  • On 6/7/2013 5:40 AM, Christian Ramer wrote:

    hmm I did that already. Do I have to put the dll on a special place when I deploy the Service (I did a deploy to a local folder and than created a site in IIS pointing to that folder )



    or the basic dll (which the c# dll is a wrapper for) must this be placed somewhere special

    Maybe to show the related things:



    swox.dll (Delphi, 32bit)

    SwoxWrapper.dll (c# wrapper for swox, 32bit)

    SwoxService (wcf Service to call SwoxWrapper from 64 bit environment)

    The DLL(s) must be placed in the Bin folder in the virtual directory for Web Service application on IIS, if the two DLLS you are talking about are .NET DLL(s).

    You can go to any virtual directory for a Web site application using IIS7 Manager. You can go to the Bin folder, right-click the folder and use Explore to see the DLL(s) and/or the associated PDB(s) to see what needs to be there.

    For now, you should go back to this solution in the VS IDE to the project, right-click it and tell it to create a "Virtual Directory" on the Web tab and and everything for the project will be put into their proper place out on IIS.

    Friday, June 7, 2013 10:40 AM
  • On 6/7/2013 7:13 AM, Christian Ramer wrote:

    Hello

    the wrapper is .net, the original one not.

    And VS does not allow me to create virtualdirectory

    Yes, VS does allow you to create a virtual directory. You have to be admin on the computer and do a "Run As Administrator", if using Vista, Win 7 or Windows 8 with UAC enabled, which can be set on the short-cut for the VS.exe by going to the Advanced tab and setting it permanently.

    You can also so set this on the properties of the VS.exe when you select Properties for the exe file in Explorer. Without "Run As Administrator" to escalate privileges when the VS.exe is started, then you don't have admin rights with VS to create a VD in IIS even if you are admin on the machine with UAC enabled.

    If the second DLL is NOT a .NET DLL,  then it's COM DLL. COM DLL(s) must be registered with the O/S using Regsvr32 at the Command Prompt  in order for the O/S to find that DLL.

    I don't even know how you got it to work the first time without IIS being in the equation if that COM DLL was not resisted with the O/S.

    <http://www.start64.com/index.php?option=com_content&id=959&Itemid=126>

    Friday, June 7, 2013 11:46 AM
  • Thx a lot I think I stop that because I tried to install only one of that dlls and there are another 10 missing than....so seems to be something with an open end.

    Because our servers are very restricted I wont be able to install this many dlls, especially there is crap in like "Windows Movie Maker" and so on.

    Friday, June 7, 2013 2:21 PM

All replies

  • On 6/7/2013 5:31 AM, Christian Ramer wrote:

    Hello

    I do have a problem.

    there is a .net dll, wrapping a native dll (works fine). Now I have to create a web service calling the wrapper dll because I have to call function from a 64bit app.

    How can I realize this? I tried something but it seems my service does not communicate with the dll

    All you have to do is set reference to the DLL in the WCF project I would think. You would do a Using (C#) or Imports (VB).NET to in the WCF project to use the namespace of the DLL to access the code in the DLL.

    Friday, June 7, 2013 9:38 AM
  • hmm I did that already. Do I have to put the dll on a special place when I deploy the Service (I did a deploy to a local folder and than created a site in IIS pointing to that folder )

    or the basic dll (which the c# dll is a wrapper for) must this be placed somewhere special

    Maybe to show the related things:

    swox.dll (Delphi, 32bit)

    SwoxWrapper.dll (c# wrapper for swox, 32bit)

    SwoxService (wcf Service to call SwoxWrapper from 64 bit environment)

    Friday, June 7, 2013 9:40 AM
  • On 6/7/2013 5:40 AM, Christian Ramer wrote:

    hmm I did that already. Do I have to put the dll on a special place when I deploy the Service (I did a deploy to a local folder and than created a site in IIS pointing to that folder )



    or the basic dll (which the c# dll is a wrapper for) must this be placed somewhere special

    Maybe to show the related things:



    swox.dll (Delphi, 32bit)

    SwoxWrapper.dll (c# wrapper for swox, 32bit)

    SwoxService (wcf Service to call SwoxWrapper from 64 bit environment)

    The DLL(s) must be placed in the Bin folder in the virtual directory for Web Service application on IIS, if the two DLLS you are talking about are .NET DLL(s).

    You can go to any virtual directory for a Web site application using IIS7 Manager. You can go to the Bin folder, right-click the folder and use Explore to see the DLL(s) and/or the associated PDB(s) to see what needs to be there.

    For now, you should go back to this solution in the VS IDE to the project, right-click it and tell it to create a "Virtual Directory" on the Web tab and and everything for the project will be put into their proper place out on IIS.

    Friday, June 7, 2013 10:40 AM
  • Hello

    the wrapper is .net, the original one not.

    And VS does not allow me to create virtualdirectory

    Friday, June 7, 2013 11:13 AM
  • On 6/7/2013 7:13 AM, Christian Ramer wrote:

    Hello

    the wrapper is .net, the original one not.

    And VS does not allow me to create virtualdirectory

    Yes, VS does allow you to create a virtual directory. You have to be admin on the computer and do a "Run As Administrator", if using Vista, Win 7 or Windows 8 with UAC enabled, which can be set on the short-cut for the VS.exe by going to the Advanced tab and setting it permanently.

    You can also so set this on the properties of the VS.exe when you select Properties for the exe file in Explorer. Without "Run As Administrator" to escalate privileges when the VS.exe is started, then you don't have admin rights with VS to create a VD in IIS even if you are admin on the machine with UAC enabled.

    If the second DLL is NOT a .NET DLL,  then it's COM DLL. COM DLL(s) must be registered with the O/S using Regsvr32 at the Command Prompt  in order for the O/S to find that DLL.

    I don't even know how you got it to work the first time without IIS being in the equation if that COM DLL was not resisted with the O/S.

    <http://www.start64.com/index.php?option=com_content&id=959&Itemid=126>

    Friday, June 7, 2013 11:46 AM
  • without iis it was on a different server ;-)

    And yes you are able to create the virtualdirectory from inside VS, but an error occured. I now just deployed the service to local file system, added a website to iss and added the virtual directory inside iis itself

    Friday, June 7, 2013 11:53 AM
  • the more problem I have now is that I am not able to register the base dll so I do have some more problems I think
    Friday, June 7, 2013 11:56 AM
  • On 6/7/2013 7:56 AM, Christian Ramer wrote:

    the more problem I have now is that I am not able to register the base dll so I do have some more problems I think

    What O/S is this?

    Friday, June 7, 2013 12:13 PM
  • The Webserver is Windows 2008 R2
    Friday, June 7, 2013 12:16 PM
  • On 6/7/2013 8:16 AM, Christian Ramer wrote:

    The Webserver is Windows 2008 R2

    And you have admin rights on the server? If you don't, then I don't think you can use Regsvr32.exe.

    Friday, June 7, 2013 12:46 PM
  • I have admin rights but the base dll (swox.dll) is very old and unmanaged code.

    The .net wrapper uses "dllimport" to get the stuff running (the swox.dll was copied beside the swoxwrapper.dll when I tried the stuff on 32 bit systems.)

    now the Webservice uses the SwoxWrapper and this should use the old unmanaged swox.dll an before

    Friday, June 7, 2013 12:52 PM
  • On 6/7/2013 8:52 AM, Christian Ramer wrote:

    I have admin rights but the base dll (swox.dll) is very old and unmanaged code.

    It's a COM DLL and it must be registered with regsvr32.

    Did you put the DLL in the WOW folder on the 64bit O/S, went there at the Command Prompt and tried to register it?

    C:\Windows\SysWOW64 folder


    The .net wrapper uses "dllimport" to get the stuff running (the swox.dll was copied beside the swoxwrapper.dll when I tried the stuff on 32 bit systems.)

    .NET DLL(s) do not need to be registered .NET will find it, and COM DLL(s) do need to be registered with the O/S. That DLL must have been already registered on the other computer, if you didn't do it. When you registered the DLL,  a path to the DLL is known for the DLL, and the O/S uses that registered path to find the DLL.

    So if you copied the DLL and did not moved it from itss registered location, then it doesn't make a difference that you copied that DLL to a new location, because the O/S is using it from the registered location of the DLL.


    now the Webservice uses the SwoxWrapper and this should use the old unmanaged swox.dll an before

    Maybe the COM DLL has other dependencies (other DLL(s)) that are not registered either.
     http://www.dependencywalker.com/

    Friday, June 7, 2013 1:25 PM
  • I cannot register the original swox.dll it gives an error (The module "swox.dll" was loaded but the entry-point was not found. Make sure that ....

    If there are more dependencies in the COM DLL i do not know and have to check

    Friday, June 7, 2013 1:31 PM
  • On 6/7/2013 9:31 AM, Christian Ramer wrote:

    The module "swox.dll" was loaded but the entry-point was not found.

    <http://msdn.microsoft.com/en-us/library/windows/desktop/aa366757(v=vs.85).aspx>

    <http://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.71).aspx>

    Friday, June 7, 2013 1:46 PM
  • ok what dependencywalker tells me is that the following dlls cannot be found on my server:

    gpsvc.dll

    ieshims.dll

    MF.dll

    MFPLAT.dll

    MFREADWRITE.dll

    WLANAPI.dll

    what kind of bu..sh.. is this?

    Friday, June 7, 2013 1:48 PM
  • On 6/7/2013 9:48 AM, Christian Ramer wrote:

    ok what dependencywalker tells me is that the following dlls cannot be found on my server:

    gpsvc.dll

    ieshims.dll

    MF.dll

    MFPLAT.dll

    MFREADWRITE.dll

    WLANAPI.dll



    what kind of bu..sh.. is this?

    The bottom line is wherever this DLL is on another machine that you say is working, then search for the DLL(s), copy them and register them on the other computer.

    If they were all .NET DLL(s), then all you would need to do is copy them to the location of the .NET DLL or EXE that's going to use them. But they most likely are not .NET DLL(s), and they are all COM DLL(s).

    My dear, in the COM days (old school), you are now in what is known as DLL Hell --- 16 or 32 bit.  :)

    <http://en.wikipedia.org/wiki/DLL_hell>

    Friday, June 7, 2013 2:02 PM
  • Thx a lot I think I stop that because I tried to install only one of that dlls and there are another 10 missing than....so seems to be something with an open end.

    Because our servers are very restricted I wont be able to install this many dlls, especially there is crap in like "Windows Movie Maker" and so on.

    Friday, June 7, 2013 2:21 PM