0x800401f3 COMInterop Dll的类字符串无效
本文关键字:字符串 无效 COMInterop Dll 0x800401f3 | 更新日期: 2023-09-27 18:22:25
我有一个注册为COM Interop:的C#Dll
[Guid("B41C2229-DBBD-4614-AE28-BFAE82B10F20")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface ITestCls
{
[DispId(1)]
string test(string input);
}
[Guid("5E88B6B8-AE17-40A0-917A-51DEBD818145")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("TestNm.TestCls")]
public class TestCls : ITestCls
{
public string test(string input)
{
Console.WriteLine("INSIDE CS :: ");
return "CS :: ARE YOU TESTING WITH THIS INPUT " + input;
}
}
我试着从我的C++代码中调用相同的代码:
CoInitialize(NULL);
std::cout << data << ''n';
_bstr_t bstrt(data);
BSTR lResult;
CComQIPtr<IWPrint> iWrapClass;
HRESULT hresult;
hresult = iWrapClass.CoCreateInstance(L"TestNm.TestCls");
printf("0x%08lx", hresult);
if (SUCCEEDED (hresult))
{
iWrapClass->test(bstrt,&lResult);
wprintf(L"Response %s'n", lResult);
}
CoUninitialize();
return lResult;
当我从其他机器运行相同的程序时,我的开发人员机器上的一切都很好HRESULT给我这个:
0x800401f3
我是不是错过了一些注册?
感谢
故障排除时要尝试的几件事:
- 将托管程序集的目标CPU平台设置为x86(32位)
- 确保程序集具有强名称
- 在目标计算机上,使用32位版本的RegAsm.exe(C:''Windows''Microsoft.NET''Framework''v4.0.30119''RegAsm.exe,而不是C:''Windows''Microsoft.NET ''Framework64''v4.0.30319''RegAsm.exe)
- 使用
RegAsm.exe /codebase
在目标计算机上注册它(需要一个强程序集名称)
yes看起来像(regasm)it或perms看到walk-through
http://www.iis.net/learn/media/web-playlists/web-playlists-for-iis-extending-web-playlists-through-custom-providers