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);
}
}