Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net &引用;找不到路径的一部分“;_Asp.net_Vb.net_Iis - Fatal编程技术网

Asp.net &引用;找不到路径的一部分“;

Asp.net &引用;找不到路径的一部分“;,asp.net,vb.net,iis,Asp.net,Vb.net,Iis,我在ASP.NET中编写的web应用程序需要帮助代码在本地主机上运行良好,但在服务器上运行时出现“找不到部分路径”错误(Windows server 2008 R2上的IIS 7.5)。 这是一个我正在测试的部分,看看我们的网络传输驱动器上是否存在以用户登录名命名的目录(if directory.exists),所以我猜我的问题是权限或安全相关的(见下文) 我已经在sites web.config文件(见下文)中为其他应用程序使用模拟,并且我根据用户的用户名(environment.userna

我在ASP.NET中编写的web应用程序需要帮助代码在本地主机上运行良好,但在服务器上运行时出现“找不到部分路径”错误(Windows server 2008 R2上的IIS 7.5)。
这是一个我正在测试的部分,看看我们的网络传输驱动器上是否存在以用户登录名命名的目录(if directory.exists),所以我猜我的问题是权限或安全相关的(见下文)

我已经在sites web.config文件(见下文)中为其他应用程序使用模拟,并且我根据用户的用户名(environment.username)及其表单输入的网络密码对用户进行active directory身份验证

我尝试过使用UNCs(错误变成拒绝访问路径),也遇到过一个安全管理器类和两个直接映射所需驱动器的方法,但都没有用

我需要能够做的是将原型文件从一个网络位置复制到另一个名称下的用户传输文件夹,并将CSV文件写入同一位置

是否浏览并查看其他相关问题/答案,有些问题/答案似乎很接近,但没有一个问题/答案具有“复制到网络”组件。。。(最近的:System.IO.DirectoryNotFoundException:找不到路径的一部分)

Web.config

<authentication mode="Windows"/>
<authorization> <deny users="?"/> </authorization>
<identity impersonate="true"/>

该网站正在应用程序池中运行。AppPool正在用户帐户下运行,如果尚未将AppPool的用户帐户更改为可以访问T:上的文件的帐户,则可能会出现错误。此外,您必须使用UNC路径而不是T:,因为AppPool用户帐户不会有T:驱动器映射。谢谢Tony,我将对此进行调查并发回我的结果。
    Public Sub MakeItemLoaderFile(ByVal Numrec As Integer)
        "   Truncating Datastring and writealltext for readability
        Dim DateStr As String = Now.Month & "/" & Now.Day & "/" & Now.Year
        Dim seednumber As Integer = (HighNumber - Numrec) + 1
        Dim datastring As String = ""
        Dim TemplateFile As String = "J:\Shared\Cad\TEMPLATES\CORP-D.DWG"
        Try
            If Directory.Exists("T:\" & username) = False Then 
                FileSystem.MkDir("T:\" & username)
            End if
            Dim ItemLoaderFile As String = "T:\" & username & _
                    "\LoaderFile-" & seednumber.ToString & "-" & Now.Day & _
                    Now.Month & Now.Year & ".CSV"
            If Not FileIO.FileSystem.FileExists(ItemLoaderFile) Then
                   My.Computer.FileSystem.WriteAllText(ItemLoaderFile, _                        
                       "Item,Title,Comment,Facility Name,..." & vbCrLf, _ 
                        True, System.Text.Encoding.ASCII)
                   For stepcount As Integer = 0 To Numrec - 1
                       FileSystem.FileCopy(TemplateFile, "T:\" & username 
                           & "\" & seednumber.ToString & ".DWG")
                       datastring = "T:\" & username & "\" &                 
                           seednumber.ToString)
                       FileSystem.WriteAllText(ItemLoaderFile, datastring _
                           & vbCrLf, True)
                       seednumber = seednumber + 1
                   Next
             End If
        Catch ex As Exception
            popmessage("Drawing Numbers - MakeItemLoaderFile Error: " & _ 
            ex.Message.ToString, "CADWEB Drawing Numbers Error")
        End Try
    End Sub