设置虚拟目录&应用程序
1、添加一个网站后,Log是其他目录的文件

Log是虚拟路径,真正的是物理路径,并且和网站并非一个目录

2、添加应用程序


先部署BitAuto.ISDC.OA.Web,在网站下面添加应用程序BitAuto.ISDC.OA.WebAdmin,两个独立的网站部署到同一个域名下
虚拟目录程序会共享父域名web.config,使用inheritInChildApplications就不会被虚拟目录使用
<location path="." allowOverride="true" inheritInChildApplications="false"> <system.web> <compilation debug="true" targetFramework="4.0"/> <!-- 通过 <authentication> 节可以配置 安全身份验证模式,ASP.NET 使用该模式来识别来访用户身份。 --> <authentication mode="Windows"/> <!-- 如果在执行请求的过程中出现未处理的错误, 则通过 <customErrors> 节 可以配置相应的处理步骤。具体而言, 开发人员通过该节可配置要显示的 html 错误页, 以代替错误堆栈跟踪。 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> </system.web> </location>
获取虚拟目录下的文件的物理路径
string FilePath="/ImportFiles/UpLoad/0/0/0/64d7ce1f-e2f9-4e2d-bb36-b5993e644098.xlsx";
HttpContext.Current.Server.MapPath("/admin" + FilePath);
admin为IIS虚拟目录名称,如果不加admin,就得父应用程序的路径

浙公网安备 33010602011771号