NeatUpload 在远程服务器上上传 pdf 和 gif 文件时出现问题

发布于 2024-12-02 05:07:34 字数 3609 浏览 1 评论 0原文

我们最近遇到了这个问题,pdf 和 gif 文件无法在我们的远程系统测试服务器上成功上传。其他文件格式(例如 .docx、.xls、.jpg)以及所有文件类型都可以在开发环境中使用。两台服务器都是 Windows Server 2008 R2 Standard、IIS7.5,并运行 asp.net 4.0 Web 应用程序。

在搜索谷歌时,我看到了一些确保正确使用 .close() 的参考文献,我认为我这样做是因为这适用于其他文件类型和开发人员。另外,就 app_data\NeatUpload_Temp 文件夹的权限而言,我确保运行帐户具有写入权限。

以下是一些伪 C# 代码: -

if(inputFile.HasFile)
{
//Get the uploaded content
byte[] fileBytes = ReadContentsFromUploadedFile(inputFile);

//Get the uploaded file name
string fileName = GetFileNameFromUploadedFile(inputFile);

//Get the MIME type
string mimeType = inputFile.ContentType;

//Create custom object and store doc in SharePoint via web service

inputFile.FileContent.Close();
}

以及来自 Web.config 的片段: -

<neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"  useHttpModule="true"     maxNormalRequestLength="102400" maxRequestLength="102400"     defaultStorageProvider="FilesystemUploadStorageProvider"      defaultStateStoreProvider="InProcUploadStateStoreProvider">
<providers>
<add name="FilesystemUploadStorageProvider"     type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
<add name="InProcUploadStateStoreProvider"     type="Brettle.Web.NeatUpload.InProcUploadStateStoreProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>

非常感谢任何帮助或指导!

下面的堆栈跟踪: -

说明:当前 Web 请求执行期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

异常详细信息:System.IO.IOException:进程无法访问文件“C:\inetpub\wwwroot\UWP_SIT\app_data\NeatUpload_Temp\5b25efcf6e9246c1b989640f623486c0.config”,因为它正在被另一个进程使用。

源错误:

当前 Web 请求执行期间生成未处理的异常。有关异常来源和位置的信息可以使用下面的异常堆栈跟踪来识别。

堆栈跟踪:

[IOException: The process cannot access the file 'C:\inetpub\wwwroot\UWP_SIT\app_data\NeatUpload_Temp\5b25efcf6e9246c1b989640f623486c0.config' because it is being used by another process.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12896359
System.IO.FileInfo.Delete() +183
Brettle.Web.NeatUpload.FilesystemUploadedFile.Dispose() +909
Brettle.Web.NeatUpload.FileControl.OnUnload(EventArgs e) +235
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +160
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Page.UnloadRecursive(Boolean dispose) +24
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11351550
System.Web.UI.Page.ProcessRequest() +269
System.Web.UI.Page.ProcessRequest(HttpContext context) +167
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +625
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

We've recently run into this issue whereby pdf and gif files will not upload successfully on our remote system test server. Other file formats such as .docx, .xls, .jpg work and all file types work in the development environment. Both servers are Windows Server 2008 R2 Standard, IIS7.5 and run an asp.net 4.0 web application.

On searching google I've seen some references to making sure to use .close() properly, which I think I do as this works for other file types and on dev. Also in terms of permissions to the app_data\NeatUpload_Temp folder, I've ensured that the running account has write access.

Here's some pseudo C# code: -

if(inputFile.HasFile)
{
//Get the uploaded content
byte[] fileBytes = ReadContentsFromUploadedFile(inputFile);

//Get the uploaded file name
string fileName = GetFileNameFromUploadedFile(inputFile);

//Get the MIME type
string mimeType = inputFile.ContentType;

//Create custom object and store doc in SharePoint via web service

inputFile.FileContent.Close();
}

And a snippet from the Web.config: -

<neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"  useHttpModule="true"     maxNormalRequestLength="102400" maxRequestLength="102400"     defaultStorageProvider="FilesystemUploadStorageProvider"      defaultStateStoreProvider="InProcUploadStateStoreProvider">
<providers>
<add name="FilesystemUploadStorageProvider"     type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
<add name="InProcUploadStateStoreProvider"     type="Brettle.Web.NeatUpload.InProcUploadStateStoreProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>

Any help or direction much appreciated!

Stack trace below: -

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\UWP_SIT\app_data\NeatUpload_Temp\5b25efcf6e9246c1b989640f623486c0.config' because it is being used by another process.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[IOException: The process cannot access the file 'C:\inetpub\wwwroot\UWP_SIT\app_data\NeatUpload_Temp\5b25efcf6e9246c1b989640f623486c0.config' because it is being used by another process.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12896359
System.IO.FileInfo.Delete() +183
Brettle.Web.NeatUpload.FilesystemUploadedFile.Dispose() +909
Brettle.Web.NeatUpload.FileControl.OnUnload(EventArgs e) +235
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +160
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +323
System.Web.UI.Page.UnloadRecursive(Boolean dispose) +24
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11351550
System.Web.UI.Page.ProcessRequest() +269
System.Web.UI.Page.ProcessRequest(HttpContext context) +167
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +625
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那小子欠揍 2024-12-09 05:07:34

Web 应用程序似乎没有将文件保存到目标的权限。

您应该检查两个位置的权限:

  • neatupload 的临时上传目录(文件在其之前的位置)
    传输完成)目标目录(所在位置
    一旦完成就将它们移至)

It looks like the web application doesn't have permission to save the files to the destination.

You should check the permissions in two places:

  • neatupload's temp upload directory (where the files go before their
    transfers are complete) the destination directory (the location where
    you move them to once they are complete)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文