我正在使用C# .net,我正在尝试将一个文件上传到我的服务器。我不使用asp .net。
我跟踪了,这似乎对我不起作用。在一个侧面,这个问题是在2008年写的。
如上述问题所示,我正在使用此代码:
File.Copy("zQn69PZUx.png", "\\\\198.57.247.152\\~shiro\\public_html\\new");
//tried this also
File.Copy("zQn69PZUx.png", "\\\\198.57.247.152\\~shiro\\new");
我所犯的错误:
An
我试图将文件从临时目录复制到用户选择的文件夹。我使用的是C#,我使用的文件夹是空的。
我使用的代码是:
File.Copy(srcPath, landscapebox.Text, true);
srcPath是一个临时文件夹
landscapebox是一个文本框,它将输入一个目录。看起来应该是:
"C:\Users\####\Folder\Folder"
但我得到的是:
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll
Additional infor
我是这样做的,以前也是这样做的:
var di = new DirectoryInfo("FolderOnSharedDrive");
var files = di.GetFiles("*");
我现在有了这个异常,唯一能看到的区别是我现在有了Windows 10。
Exception thrown: 'System.IO.IOException' in mscorlib.dll
Additional information: The target account name is incorrect.
我对这段代码有困难。StreamWriter创建.txt文档并将其放入projects bin文件夹中,但当我运行该程序时,会得到一个错误,即:
'System.IO.IOException‘类型的未处理异常发生在mscorlib.dll中
进程无法访问该文件..。因为它正在被另一个进程使用。
在我的计算机上没有其他程序运行,所以我不确定其他进程可以使用它。这是我的代码,谢谢。
Private Sub saveButton_Click(sender As Object, e As EventArgs) Handles saveButton.Click
Dim voteWrit
所以还有另一个类似的问题,但我认为这有点不同。这是一笔交易,我正在开发一个应用程序,其中有一系列的组合框,用户做出选择,然后下一个组合框填充。它是有效的,但我看到了一堆这样的错误。
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
mscorlib.dll中出现'System.Runtime.InteropServices.COMException‘类型的第一次机会异常在mscorlib.dll中出现类型为'
捕获自己的
AppDomain.CurrentDomain.FirstChanceException += FirstChanceException;
private static void FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
// I would like to log exceptions happening outside my assembly?
// But this ev
我想要复制一个文件夹,并且我想先删除目标文件夹。因此,我删除目标文件夹,然后重新创建它,然后复制文件。问题是,当我试图复制文件时,我得到了An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll。这是密码
static public void CopyFolder(string sourceFolder, string destFolder)
{
if (Directory.Exists(destFolder)) // ch
当使用Visual Studio2012 RC调试时,如果打开了break on exception,Visual Studio会在.NET框架内的异常上中断。如何让它只在我的代码中出现异常时中断?
在调试ASP.NET MVC4项目时,每个页面点击都会抛出很多框架异常。以下异常经常发生:
System.Globalization.CultureNotFoundException occurred
HResult=-2147024809
Message=Culture is not supported.
Parameter name: name
UserCache is an inva
这段代码在Windows下的VisualBasic2010Professional中使用.NET 4.0时运行良好,我遇到了一些问题。但是,当这段代码在Windows 7机器上运行时,我会得到以下错误:
System.IO.IOException类型的第一次例外发生在mscorlib.dll中
“System.IO.IOException类型的未处理异常发生在Mscorlib.dll中”
我编写的代码用于将ListBox的内容写入文本文件。
问题是文件不是创建的,或者是手动创建的,没有读取,这只发生在Windows 7中。
这是我写的代码:
'at the very to
你好,我正在尝试在我的第一个windows窗体应用程序可执行文件中创建带有文本文档的目录文件,但是这里有一些问题:
我希望其他本地用户计算机可以使用exe文件:
string dir = @"C:\Users\Public\AppData\Roaming\AppFolder\document.txt";
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(Path.GetDirectoryName(dir));
var stream = File.CreateText(dir);
}
但我得到了这个
S
string savePath = Server.MapPath("\\Upload_File\\");
// Get the name of the file to upload.
string fileName = email_attach.FileName;
string pathToCheck = savePath + fileName;
email_attach.SaveAs(pathToCheck);
string file = pathToCheck;
Attachment data = new Attachment(file);
mail.Attachme
当使用TableEntities返回WebAPI列表时,我将得到一个500个内部服务器错误。当我查看Visual中的输出时,我看到我得到了这些'System.Runtime.Serialization.SerializationException'.
这是我在控制器中的代码
public IEnumerable<ContactEntity> Get()
{
var creds = new StorageCredentials("MyAccountName", "MyKey");
var sto
我有以下代码来生成报告PDF,上传它,然后删除生成过程中使用的临时图像:
// Generate document and then add a section with an image
var document = new Document {Info = {Title = "Results"}};
var section = document.AddSection();
var logo = section.AddImage(logoPath);
// Render the PDF
const PdfFontEmbedding embedding = PdfFontEm