简体   繁体   English

无法让 ASP.NET 上传文件示例在 IIS 本地网络上工作

[英]Can't get asp.net upload file example to work on IIS local network

I'm trying to upload files to my computer from another device connected to the same network.我正在尝试从连接到同一网络的另一台设备将文件上传到我的计算机。 I already can view and download files from my computer on my smartphone, but I still don't know how can I upload files from my smartphone to my computer.我已经可以在智能手机上查看和下载计算机上的文件,但我仍然不知道如何将文件从智能手机上传到我的计算机。
I'm using IIS on windows 10 on my computer to host files over private ip (so it works on the same network)我在我的计算机上的 Windows 10 上使用 IIS 通过私有 ip 托管文件(因此它可以在同一网络上运行)
I have found example to upload files on https://docs.microsoft.com/en-us/troubleshoot/aspnet/upload-file-to-web-site , but when I try to implement it, it gives me error, that it can't load type 'upload.WebForm1' .我在https://docs.microsoft.com/en-us/troubleshoot/aspnet/upload-file-to-web-site上找到了上传文件的示例,但是当我尝试实现它时,它给了我错误,即它无法加载类型'upload.WebForm1' I have deleted all the code except using directives, spacename and class.除了使用指令、空间名称和类之外,我已经删除了所有代码。 Here is the code:这是代码:

WebForm1.aspx WebForm1.aspx

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
   Inherits="upload.WebForm1" %>

When I include the rest stackoverflow says red: Your post appears to contain code that is not properly formatted as code.当我包含其余内容时,stackoverflow 显示红色:您的帖子似乎包含未正确格式化为代码的代码。 Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut.请使用代码工具栏按钮或 CTRL+K 键盘快捷键将所有代码缩进 4 个空格。 For more editing help, click the [?] toolbar icon.如需更多编辑帮助,请单击 [?] 工具栏图标。 and not let me post question.并且不让我发布问题。
Rest of .aspx document is copied and not changed from complete code listing from the link above. .aspx 文档的其余部分是从上面链接的完整代码列表中复制并没有更改的。

WebForm1.aspx.cs WebForm1.aspx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
namespace upload {
public class WebForm1 : System.Web.UI.Page
{

}
}

Any ideas what's wrong?任何想法有什么问题?

Can you try changing Codebehind to CodeFile您可以尝试将Codebehind更改为CodeFile

<%@ Page language="c#" CodeFile="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebForm1" %> <%@ Page language="c#" CodeFile="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebForm1" %>

Usually follows for Website通常遵循网站

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM