Error HRESULT E_FAIL has been returned from a call to a COM component.

萌宠梦工场 2010-01-04 06:05:16
Server Error in '/' Application.
--------------------------------------------------------------------------------

创建快捷方式错误!Error HRESULT E_FAIL has been returned from a call to a COM component.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: 创建快捷方式错误!Error HRESULT E_FAIL has been returned from a call to a COM component.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[Exception: 创建快捷方式错误!Error HRESULT E_FAIL has been returned from a call to a COM component.]
WebCommn._Default.AddShortcut() in D:\webtext\创建快捷方式\WebCommn\WebCommn\a.aspx.cs:51
WebCommn._Default.Button1_Click(Object sender, EventArgs e) in D:\webtext\创建快捷方式\WebCommn\WebCommn\a.aspx.cs:25
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053



不知道是什么原因,在本地调试一切正常,但是上传到服务器上后就出现了这样的问题


1. 在控制面板--->管理工具--->服务 中,开启Distributed Transaction Coordinator 服务。

2. 打开控制面板--->管理工具--->组件服务--->选择计算机--->我的电脑--->右击属性--->选择MSDTC--->选择安全配置 勾选事务管理器通信中的允许出站、允许入站和不要求进行验证。

以上两种方法已经做过,但是还不行!
哪位仁兄帮忙解决下


程序源码
private void AddShortcut()
{
//string[] vPath = this.targetdir.Split('\\');
//string url = "http://" + this.iis + "/" + vPath[vPath.Length - 2];
string url = "http://www.abcde.com/";
try
{
string mysite = url;

//创建收藏夹快捷方式
string fav = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Favorites) + "\\求医网.url";
IWshShell_Class wshShell = new IWshShell_ClassClass();//创建 Windows Script Host Shell 类
IWshURLShortcut favShortcut = wshShell.CreateShortcut(fav) as IWshURLShortcut;//定义快捷方式文件
favShortcut.TargetPath = mysite;
favShortcut.Save();//保存快捷方式

//创建桌面快捷方式
string desktop = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory) + "\\桌面文件名.url";
IWshURLShortcut desktopShortcut = wshShell.CreateShortcut(desktop) as IWshURLShortcut;
desktopShortcut.TargetPath = mysite;
desktopShortcut.Save();//保存快捷方式
}
catch (Exception exc)
{
throw new Exception("创建快捷方式错误!" + exc.Message);
}
}

...全文
1352 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
萌宠梦工场 2010-01-04
  • 打赏
  • 举报
回复
不明白是什么意思!!!!等于没说!
Lovely_baby 2010-01-04
  • 打赏
  • 举报
回复
错误:asp net的运行时间错误:HRESULT E_FAIL 已经从电话到com部分的返回!

62,254

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧