Windows Server 2012 64位 IIS8 ASP.NET Framework 4
尝试从我的aspx页面运行非托管DLL
执行DLL函数调用给出:
启用了Just-In-Time调试器,但没有必要的安全权限。要调试此过程,必须以管理员身份运行实时调试程序。你想调试这个过程吗?
在Web服务器上没有我知道的调试器,尝试启动它会产生错误。
我已经广泛搜索了这个,所有的帮助似乎都是关于Visual Studio,而不是IIS。 Web服务器上没有Visual Studio。
这是有问题的代码。
private string regname = "";
private string fingerprint = "";
private string unlockingcode = "";
/// <summary>
/// called from page_load
/// </summary>
private void CreateUnlockingCode()
{
UInt32 lfp;
string sfp = fingerprint.Remove(4, 1);
lfp = Convert.ToUInt32(sfp, 16);
string bindir = Server.MapPath(@"~/bin/CodeGen64.dll"); //full path to the DLL "P:\\AFI2013\\bin\\CodeGen64.dll"
IntPtr pDll = NativeMethods.LoadLibrary(bindir); //attempt to load the library
try
{
IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "CreateCode2A");
CreateCode2 createCode2 = (CreateCode2)Marshal.GetDelegateForFunctionPointer(
pAddressOfFunctionToCall,
typeof(CreateCode2));
//THIS LINE CRASHES THE ASPNET WORKER PROCESS
unlockingcode = createCode2(1, regname, encrypt_template, lfp, (UInt16)0, (UInt16)0, (UInt16)0, (UInt16)0, (UInt16)0);
}
finally
{
bool result = NativeMethods.FreeLibrary(pDll);
}
}
这是事件查看器中的错误。
Log Name: Application
Source: Application Error
Date: 7/10/2013 11:34:30 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: owl.INT.local
Description:
Faulting application name: w3wp.exe, version: 8.0.9200.16384, time stamp: 0x50108835
Faulting module name: ntdll.dll, version: 6.2.9200.16579, time stamp: 0x51637f77
Exception code: 0xc0000374
Fault offset: 0x00000000000ebd59
Faulting process id: 0x2608
Faulting application start time: 0x01ce7d9c1d409343
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 5b36e881-e98f-11e2-9406-000c2908dae4
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-07-10T18:34:30.000000000Z" />
<EventRecordID>54586</EventRecordID>
<Channel>Application</Channel>
<Computer>owl.INT.local</Computer>
<Security />
</System>
<EventData>
<Data>w3wp.exe</Data>
<Data>8.0.9200.16384</Data>
<Data>50108835</Data>
<Data>ntdll.dll</Data>
<Data>6.2.9200.16579</Data>
<Data>51637f77</Data>
<Data>c0000374</Data>
<Data>00000000000ebd59</Data>
<Data>2608</Data>
<Data>01ce7d9c1d409343</Data>
<Data>c:\windows\system32\inetsrv\w3wp.exe</Data>
<Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
<Data>5b36e881-e98f-11e2-9406-000c2908dae4</Data>
<Data>
</Data>
<Data>
</Data>
</EventData>
</Event>