小编Urv*_*shi的帖子

从ftp服务器下载文件时"基础连接已关闭"

我想从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)

c#

12
推荐指数
1
解决办法
1119
查看次数

'<',十六进制值 0x3C,是无效的属性字符

我已经开发了 VSTO 插件。现在,当我尝试在我的机器上安装 VSTO Addin 时,出现如下异常。

System.Xml.XmlException: '<',十六进制值 0x3C,是无效的属性字符。第 21 行,位置 39。

我已经在第 21 行签入了 .vsto 文件。该行如下。

<publisherIdentity name="CN=&quot;&lt;itranscript.net&gt;&quot;"/>
Run Code Online (Sandbox Code Playgroud)

上面一行有什么问题。谁能帮我?

.net c# vsto

7
推荐指数
3
解决办法
2万
查看次数

每2分钟运行一次任务计划程序

我想创建每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)

c#

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×3

.net ×1

vsto ×1