我正在尝试从服务器将Hex文件上传到UNO模块。 代码已成功上传到localhost中的UNO ,当我在godaddy服务器上托管时,它给出了一个错误 如何解决?
using ArduinoUploader;
using ArduinoUploader.Hardware;
using System;
using System.IO.Ports;
namespace AmpliBurn
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string[] arr = SerialPort.GetPortNames();
DropDownList2.Items.Clear();
foreach (var item in arr)
{
DropDownList2.Items.Add(item);
}
}
public void read(string aPath)
{
// string content = File.ReadAllText(aPath);
// Label4.Text = content;
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
String fname;
fname = Server.MapPath(DropDownList1.SelectedValue.ToString());
read(fname);
var uploader = new ArduinoSketchUploader(
new ArduinoSketchUploaderOptions()
{
FileName = fname,
PortName = DropDownList2.SelectedItem.Text,
ArduinoModel = ArduinoModel.UnoR3
});
uploader.UploadSketch(); // error in this line
Label3.Text = "Success";
}
catch (Exception exception )
{
Label3.Text= exception.InnerException + "_" + exception.Message + "//" + exception.StackTrace;
//System.IO.File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory+ "/Excception.txt", exception.InnerException+"_"+exception.Message+"//"+exception.StackTrace);
}
}
}
}
错误:
通过方法'RJCP.IO.Ports.Native.WinNativeSerial.get_IsOpen()'进行尝试 访问字段'RJCP.IO.Ports.Native.WinNativeSerial.m_ComPortHandle' 失败。//在以下位置的RJCP.IO.Ports.Native.WinNativeSerial.get_IsOpen() c:\ Users \ jcurl \ Documents \ Programming \ HELIOS \ serialportstream \ code \ Native \ WinNativeSerial.cs:line RJCP.IO.Ports.Native.WinNativeSerial.Dispose(布尔处理)处的643 在 c:\ Users \ jcurl \ Documents \ Programming \ HELIOS \ serialportstream \ code \ Native \ WinNativeSerial.cs:line 1070在RJCP.IO.Ports.Native.WinNativeSerial.Dispose()中 c:\ Users \ jcurl \ Documents \ Programming \ HELIOS \ serialportstream \ code \ Native \ WinNativeSerial.cs:line 1058在RJCP.IO.Ports.SerialPortStream.GetPortNames()中 c:\ Users \ jcurl \ Documents \ Programming \ HELIOS \ serialportstream \ code \ SerialPortStream.cs:line 319点 ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)在 ArduinoUploader.ArduinoSketchUploader.UploadSketch()位于 AmpliBurn.index.Button1_Click(Object sender,EventArgs e)在 C:\ Users \ Sutirtha Z Innocent \ source \ repos \ AmpliBurn \ AmpliBurn \ index.aspx.cs:第46行