本文介绍了在ASP中使用FaxModem拨号发送传真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ASP中使用调制解调器发送传真
我使用此代码发送传真,
我的问题是我在本地(Visual Studio)中发送传真
上传网站并发送传真时,我看到此错误
"ConnectAccess被拒绝.(来自HRESULT的异常:0x80070005(E_ACCESSDENIED))-11等待操作超时.(来自HRESULT的异常:0x80070102)"
并且根文件的权限被允许给任何用户

I want to send fax with modem in ASP
an i use this code to send fax,
my problem is I send the fax in Local(Visual Studio)
when upload the site and i want to send fax,I see this Error
"ConnectAccess is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))--11The wait operation timed out. (Exception from HRESULT: 0x80070102)"
and the permission of the root file is Allowed to any user

public void FaxDocument(String TheFile, string faxnumber)
{
   FAXCOMLib.FaxServer server = new FaxServerClass();
    FAXCOMLib.FaxDoc doc = null;
    int response = -11;

    try
    {
        server.Connect(Environment.MachineName);
    }
    catch(Exception e)
    {
        lbl.Text +="-Connect"+ e.Message;
        //System.Console.WriteLine("1"+e.Message);
    }

    try
    {
        doc = (FAXCOMLib.FaxDoc)server.CreateDocument(TheFile);
    }
    catch(Exception e)
    {
        lbl.Text += "-doc error" + e.Message;
        //System.Console.WriteLine("doc error"+e.Message);
    }

    try
    {
        doc.FaxNumber = faxnumber;
        doc.RecipientName = "Test";
        doc.DisplayName = "work";
    }
    catch(Exception e)
    {
        lbl.Text += "assignments" + e.Message;
        //System.Console.WriteLine("assignments" + e.Message);
    }


    try
    {

        response = doc.Send();
        Process myProcess = new Process();
        if (Process.GetProcessesByName("AcroRd32").Length > 0)
        {
            myProcess = Process.GetProcessesByName("AcroRd32")[0];
            if (DateTime.Now.Ticks - myProcess.StartTime.Ticks > TimeSpan.FromSeconds(1).Ticks)
                myProcess.Kill();
        }
    }
    catch(Exception e)
    {
        lbl.Text +="-"+ response + e.Message;
        //System.Console.WriteLine( response + e.Message);
    }

    try
    {
        server.Disconnect();
    }
    catch(Exception e)
    {
        lbl.Text += "disconnect" + e.Message;
        //System.Console.WriteLine("2"+e.Message);
    }
    lbl.Text += "Successful";
}

推荐答案


这篇关于在ASP中使用FaxModem拨号发送传真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 07:01