Мне нужно подключить библиотеку «Натив» x86 c/c ++ *.dll к службе WCF C# 4.0 Hosted Local в моем компьютере (IIS7.5). Я вызываю метод службы по http request (метод [Webget]). Я получаю ошибку:
http://s1.ipicture.ru/uploads/20120509/h8tvurse.jpg
dllnotfoundexcept Из HRESULT: 0x80070005 (e_accessdied)) < /strong> < /p>
, не могли бы вы рассказать, что может быть проблемой? x86
.NET 4.0
VS 2010
IIS7.5
Structure solutions service WCF:
http://s1.ipicture.ru/uploads/20120430/vBXivN71.jpg
Source Code
Натив C /C ++ x86 li.dll: < /p>
ли.h
extern "C" {
__declspec(dllexport) int __cdecl SimulateGameDLL (int a, int b);
}
< /code>
li.cpp
#include "Li.h"
extern int __cdecl SimulateGameDLL (int num_games, int rand_in) {
return 121;
}
< /code>
c#< /p>
proberservicelibrary1.iservice1
[ServiceContract] public interface IService1{
[OperationContract][WebGet] string GetData();
}
< /code>
wcfservicelibrary1.service1
public class Service1 : IService1{
public string GetData(){
ClassLibrary1.Class1 cl = new ClassLibrary1.Class1();
var rt = cl.M();
return string.Format("Value = : {0}", rt);
}
}
< /code>
classlibrary1.class1
public class Class1{
[DllImport("Li.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern int SimulateGameDLL(int a, int b);
public int M() {
var r = SimulateGameDLL(10, 20);
return r;
}
}
Подробнее здесь: https://stackoverflow.com/questions/104 ... ted-in-iis