我想从ftp服务器下载文件.我写了以下代码从ftp下载文件
public void downloadFile(string FTPAddress, string filename, string username, string password, string destFile)
{
try
{
FtpWebRequest request = FtpWebRequest.Create(FTPAddress + filename) as FtpWebRequest;
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential(username, password);
request.UsePassive = true;
request.UseBinary = true;
request.UseBinary = true;
request.KeepAlive = false; //close the connection when done
request.Timeout = 60000;
//Streams
using (var response = request.GetResponse())
{
using (Stream reader = response.GetResponseStream())
{
byte[] buffer = new byte[1024];
using (Stream streamFile = File.Create(destFile))
{
while (true)
{
int …Run Code Online (Sandbox Code Playgroud) 我已经开发了 VSTO 插件。现在,当我尝试在我的机器上安装 VSTO Addin 时,出现如下异常。
System.Xml.XmlException: '<',十六进制值 0x3C,是无效的属性字符。第 21 行,位置 39。
我已经在第 21 行签入了 .vsto 文件。该行如下。
<publisherIdentity name="CN="<itranscript.net>""/>
Run Code Online (Sandbox Code Playgroud)
上面一行有什么问题。谁能帮我?
我想创建每2分钟触发一次的任务计划程序.我正在使用以下namesapce
使用Microsoft.Win32.TaskScheduler
我写了以下代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32.TaskScheduler;
namespace SchedulerTest1
{
class Program
{
static void Main(string[] args)
{
// Get the service on the local machine
using (TaskService ts = new TaskService())
{
// Create a new task definition and assign properties
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Does something";
// Create a trigger that will fire the task at this time every other day
td.Triggers.Add(new DailyTrigger());
// Create an action that will launch …Run Code Online (Sandbox Code Playgroud)