遇到的问题是在VS2012里面调试是没有问题的。然后发布到IIS里面,然后用IE打开,插件那里就是一个小红色的叉叉。我发现用VS2012打开的IE,输入网页,是可以打开的。把VS2012关掉以后,单独用IE打开就是上面那个现象。查了资料说是ActiveX安全性受限。试了很多办法也不行。请问各位这个现象怎么处理?或者不用ActiveX这种方法能不能把电子秤计量嵌入到网页里面呢?
谢谢!
15 个解决方案
#1
这样的业务,根本不适合做成b/s的。
#2
哥儿,我也觉得不合适,上帝也觉着不合适,但木办法呀……
#3
在B/S里面做C/S的东西
#4
是的。没办法呀。网页好像不能操作串口吧。
#5
给你的ACTIVEX签名啊!
然后给用户个操作文档,让用户设置IE的安全性,允许ActiveX加载
然后给用户个操作文档,让用户设置IE的安全性,允许ActiveX加载
#6
楼上的说的对,找个软件,给ActiveX控件签名,
#7
用IObjectSafety接口,把ActiveX控件标记为安全的ActiveX控件
参考
http://blog.csdn.net/chuxue1342/article/details/7336538
参考
http://blog.csdn.net/chuxue1342/article/details/7336538
#8
给你参考下。
http://blog.csdn.net/yeqi3000/article/details/8224355
http://blog.csdn.net/yeqi3000/article/details/8224355
#9
有一种可行的,把ActiveX做成安装包并在那个ActiveX的控件里加入 下面的代码就可以了,这个我这几天就是把加密狗整合到网站上,让用户登录必需插入加密狗才能登录。
[ComImport, GuidAttribute("CB5BDC81-93C1-11CF-8F20-00805F2CD064")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectSafety
{
[PreserveSig]
int GetInterfaceSafetyOptions(ref Guid riid, [MarshalAs(UnmanagedType.U4)] ref int pdwSupportedOptions, [MarshalAs(UnmanagedType.U4)] ref int pdwEnabledOptions);
[PreserveSig()]
int SetInterfaceSafetyOptions(ref Guid riid, [MarshalAs(UnmanagedType.U4)] int dwOptionSetMask, [MarshalAs(UnmanagedType.U4)] int dwEnabledOptions);
}
你的Active 继承 IObjectSafety 这个接口并实现下面的
private const string _IID_IDispatch = "{00020400-0000-0000-C000-000000000046}";
private const string _IID_IDispatchEx = "{a6ef9860-c720-11d0-9337-00a0c90dcaa9}";
private const string _IID_IPersistStorage = "{0000010A-0000-0000-C000-000000000046}";
private const string _IID_IPersistStream = "{00000109-0000-0000-C000-000000000046}";
private const string _IID_IPersistPropertyBag = "{37D84F60-42CB-11CE-8135-00AA004BB851}";
private const int INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001;
private const int INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002;
private const int S_OK = 0;
private const int E_FAIL = unchecked((int)0x80004005);
private const int E_NOINTERFACE = unchecked((int)0x80004002);
private bool _fSafeForScripting = true;
private bool _fSafeForInitializing = true;
public int GetInterfaceSafetyOptions(ref Guid riid, ref int pdwSupportedOptions, ref int pdwEnabledOptions)
{
int Rslt = E_FAIL;
string strGUID = riid.ToString("B");
pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
switch (strGUID)
{
case _IID_IDispatch:
case _IID_IDispatchEx:
Rslt = S_OK;
pdwEnabledOptions = 0;
if (_fSafeForScripting == true)
pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
break;
case _IID_IPersistStorage:
case _IID_IPersistStream:
case _IID_IPersistPropertyBag:
Rslt = S_OK;
pdwEnabledOptions = 0;
if (_fSafeForInitializing == true)
pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
break;
default:
Rslt = E_NOINTERFACE;
break;
}
return Rslt;
}
public int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions)
{
int Rslt = E_FAIL;
string strGUID = riid.ToString("B");
switch (strGUID)
{
case _IID_IDispatch:
case _IID_IDispatchEx:
if (((dwEnabledOptions & dwOptionSetMask) == INTERFACESAFE_FOR_UNTRUSTED_CALLER) &&
(_fSafeForScripting == true))
Rslt = S_OK;
break;
case _IID_IPersistStorage:
case _IID_IPersistStream:
case _IID_IPersistPropertyBag:
if (((dwEnabledOptions & dwOptionSetMask) == INTERFACESAFE_FOR_UNTRUSTED_DATA) &&
(_fSafeForInitializing == true))
Rslt = S_OK;
break;
default:
Rslt = E_NOINTERFACE;
break;
}
return Rslt;
}
#10
我发布的另外一台的服务器,在我的机器上面打开,然后第一次可以打开,后面怎么搞就是个红叉叉在那里。这到底是什么原因?有没有什么办法和工具可以检测是那方面出了问题?头大。
#11
那是你控件写的有问题或被Dispose了。
#12
是这样子的:
D:\Project\XinDaFu\MyActivex\MyElectronicScale.html(可以。但是有个前提,打开之前必须把所有IE都关掉,否则不显示)
http://localhost:8000/MyActivex/MyElectronicScale.html(不行)
D:\Project\XinDaFu\MyActivex\MyElectronicScale.html(可以。但是有个前提,打开之前必须把所有IE都关掉,否则不显示)
http://localhost:8000/MyActivex/MyElectronicScale.html(不行)
#13
收藏,备以后使用
#14
ActiveX的安全设置,是本地IE的设置,添加到信任里去,或者关闭安全设置,才可以不会提示
#15
这位哥儿,能说的具体点么,怎么操作的?
1、添加到信任里去
2、关闭安全设置
#1
这样的业务,根本不适合做成b/s的。
#2
哥儿,我也觉得不合适,上帝也觉着不合适,但木办法呀……
#3
在B/S里面做C/S的东西
#4
是的。没办法呀。网页好像不能操作串口吧。
#5
给你的ACTIVEX签名啊!
然后给用户个操作文档,让用户设置IE的安全性,允许ActiveX加载
然后给用户个操作文档,让用户设置IE的安全性,允许ActiveX加载
#6
楼上的说的对,找个软件,给ActiveX控件签名,
#7
用IObjectSafety接口,把ActiveX控件标记为安全的ActiveX控件
参考
http://blog.csdn.net/chuxue1342/article/details/7336538
参考
http://blog.csdn.net/chuxue1342/article/details/7336538
#8
给你参考下。
http://blog.csdn.net/yeqi3000/article/details/8224355
http://blog.csdn.net/yeqi3000/article/details/8224355
#9
有一种可行的,把ActiveX做成安装包并在那个ActiveX的控件里加入 下面的代码就可以了,这个我这几天就是把加密狗整合到网站上,让用户登录必需插入加密狗才能登录。
[ComImport, GuidAttribute("CB5BDC81-93C1-11CF-8F20-00805F2CD064")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectSafety
{
[PreserveSig]
int GetInterfaceSafetyOptions(ref Guid riid, [MarshalAs(UnmanagedType.U4)] ref int pdwSupportedOptions, [MarshalAs(UnmanagedType.U4)] ref int pdwEnabledOptions);
[PreserveSig()]
int SetInterfaceSafetyOptions(ref Guid riid, [MarshalAs(UnmanagedType.U4)] int dwOptionSetMask, [MarshalAs(UnmanagedType.U4)] int dwEnabledOptions);
}
你的Active 继承 IObjectSafety 这个接口并实现下面的
private const string _IID_IDispatch = "{00020400-0000-0000-C000-000000000046}";
private const string _IID_IDispatchEx = "{a6ef9860-c720-11d0-9337-00a0c90dcaa9}";
private const string _IID_IPersistStorage = "{0000010A-0000-0000-C000-000000000046}";
private const string _IID_IPersistStream = "{00000109-0000-0000-C000-000000000046}";
private const string _IID_IPersistPropertyBag = "{37D84F60-42CB-11CE-8135-00AA004BB851}";
private const int INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001;
private const int INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002;
private const int S_OK = 0;
private const int E_FAIL = unchecked((int)0x80004005);
private const int E_NOINTERFACE = unchecked((int)0x80004002);
private bool _fSafeForScripting = true;
private bool _fSafeForInitializing = true;
public int GetInterfaceSafetyOptions(ref Guid riid, ref int pdwSupportedOptions, ref int pdwEnabledOptions)
{
int Rslt = E_FAIL;
string strGUID = riid.ToString("B");
pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
switch (strGUID)
{
case _IID_IDispatch:
case _IID_IDispatchEx:
Rslt = S_OK;
pdwEnabledOptions = 0;
if (_fSafeForScripting == true)
pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
break;
case _IID_IPersistStorage:
case _IID_IPersistStream:
case _IID_IPersistPropertyBag:
Rslt = S_OK;
pdwEnabledOptions = 0;
if (_fSafeForInitializing == true)
pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
break;
default:
Rslt = E_NOINTERFACE;
break;
}
return Rslt;
}
public int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions)
{
int Rslt = E_FAIL;
string strGUID = riid.ToString("B");
switch (strGUID)
{
case _IID_IDispatch:
case _IID_IDispatchEx:
if (((dwEnabledOptions & dwOptionSetMask) == INTERFACESAFE_FOR_UNTRUSTED_CALLER) &&
(_fSafeForScripting == true))
Rslt = S_OK;
break;
case _IID_IPersistStorage:
case _IID_IPersistStream:
case _IID_IPersistPropertyBag:
if (((dwEnabledOptions & dwOptionSetMask) == INTERFACESAFE_FOR_UNTRUSTED_DATA) &&
(_fSafeForInitializing == true))
Rslt = S_OK;
break;
default:
Rslt = E_NOINTERFACE;
break;
}
return Rslt;
}
#10
我发布的另外一台的服务器,在我的机器上面打开,然后第一次可以打开,后面怎么搞就是个红叉叉在那里。这到底是什么原因?有没有什么办法和工具可以检测是那方面出了问题?头大。
#11
那是你控件写的有问题或被Dispose了。
#12
是这样子的:
D:\Project\XinDaFu\MyActivex\MyElectronicScale.html(可以。但是有个前提,打开之前必须把所有IE都关掉,否则不显示)
http://localhost:8000/MyActivex/MyElectronicScale.html(不行)
D:\Project\XinDaFu\MyActivex\MyElectronicScale.html(可以。但是有个前提,打开之前必须把所有IE都关掉,否则不显示)
http://localhost:8000/MyActivex/MyElectronicScale.html(不行)
#13
收藏,备以后使用
#14
ActiveX的安全设置,是本地IE的设置,添加到信任里去,或者关闭安全设置,才可以不会提示
#15
这位哥儿,能说的具体点么,怎么操作的?
1、添加到信任里去
2、关闭安全设置