首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

100分:用 NeatUpload下传组件,在本地IIS7.5中能调通,但是放到公司测试环境IIS6上出现有关问题

2012-12-14 
100分求助:用 NeatUpload上传组件,在本地IIS7.5中能调通,但是放到公司测试环境IIS6下出现问题如题:我自己

100分求助:用 NeatUpload上传组件,在本地IIS7.5中能调通,但是放到公司测试环境IIS6下出现问题
    如题:我自己是对asp.net比较生疏.公司让写个asp.net上传工具.选择了 NeatUpload组件.在网上找遍相关资源,发现就一款能在本地电脑IIS7.5上调通.兴奋之余赶紧放到公司测试环境下(IIS6),报错.错误如下

分析器错误 
说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。 

分析器错误消息: 未能加载文件或程序集“Brettle.Web.NeatUpload”或它的某一个依赖项。系统找不到指定的文件。

源错误: 


行 1:  <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
行 2:  
行 3:  <%@ Register assembly="Brettle.Web.NeatUpload" namespace="Brettle.Web.NeatUpload" tagprefix="Upload" %> 
行 4:   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
行 5:   <html xmlns="http://www.w3.org/1999/xhtml">
 

源文件: /UpBigFile/UpBigFile/Default.aspx    行: 3 

程序集加载跟踪: 下列信息有助于确定程序集“Brettle.Web.NeatUpload”无法加载的原因。


警告: 程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。
注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

   希望得到各位的帮助.先谢了
 

[最优解释]
很多问题别人可能帮不上忙,特别是环境部署方面的问题,不在现场,不好分析。

我看到你在web.config的httpModules里面也注册了Brettle.Web.NeatUpload这个模块,理论上说如果系统找不到这个文件的话,会先报web.config设置错误。但是你现在报的是页面错误,这比较可疑。
你检查下到底web.config为什么没有报错(你可以随便在里面乱写一点东西看是否报错)
还有确认下IIS应用程序目录的设置是否正确:asp.net版本、是否对应独立的应用程序池。
部署方面的问题找你公司的同事请教是最好的。
[其他解释]
Brettle.Web.NeatUpload.dll
找到这个文件并放到bin目录下
[其他解释]
官网上的Instruction:

Things to check:
Make sure that the Brettle.Web.NeatUpload.dll is installed in the bin folder of your application.
Make sure that the top-level directory of your application is actually configured as a web application, not just a virtual dir.
Make sure that the UploadHttpModule has been added to the <httpModules> section (or <system.webServer><modules> section if you are using the DefaultAppPool with IIS7) of your Web.config.
Make sure that you don't have useHttpModule="false" in your Web.config unless you also have useHttpModule="true" in a <location> element whose path attribute corresponds to your upload page. The Web.config for the demo uses location filtering to restrict NeatUpload's request processing to the Demo.aspx page.
Make sure that you don't have ASP.NET application-wide tracing enabled for your application. ASP.NET application-wide tracing disables NeatUpload.


[其他解释]
虚拟目录没创建Application?
[其他解释]
bin目录所在的目录 要创建Application.

参考下面的文章的"使现有虚拟目录成为 Web 应用程序"小结:



演练:在 IIS 中创建 ASP.NET Web 应用程序的根目录
http://msdn.microsoft.com/zh-cn/library/ha2y9493(v=vs.80).aspx
[其他解释]
    我尽量贴出源码,希望能得到大家尽可能的帮助.问题已解决,马上结贴给分.
    webconfig部分:
    <?xml version="1.0"?>
<!-- 
    注意: 除了手动编辑此文件以外,您还可以使用 
    Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
     “网站”->“Asp.Net 配置”选项。
    设置和注释的完整列表在 
    machine.config.comments 中,该文件通常位于 
    \Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings/>
<connectionStrings/>
<system.web>
<!-- 
            设置 compilation debug="true" 可将调试符号插入
            已编译的页面中。但由于这会 
            影响性能,因此只在开发过程中将此值 
            设置为 true。
        -->
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
</compilation>
<!--
            通过 <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>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload"/>
</httpModules>
<httpRuntime maxRequestLength="400000" executionTimeout="3600"/>
</system.web>
<system.codedom>


<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<!-- 
        在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer
        节。对早期版本的 IIS 来说则不需要此节。
    -->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

[其他解释]
default.aspx部分:
   <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Brettle.Web.NeatUpload" Namespace="Brettle.Web.NeatUpload"


    TagPrefix="Upload" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
        <Upload:ProgressBar ID="ProgressBar1" runat="server" />
    <Upload:InputFile ID="InputFile1" runat="server" />
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="上 传" Width="64px" />
    </form>
</body>
</html>

[其他解释]
default.aspx.cs部分:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using Brettle.Web.NeatUpload;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.InputFile1.HasFile)
        {
            string FileName = this.InputFile1.FileName;//获取上传文件的文件名,包括后缀
            string ExtenName = System.IO.Path.GetExtension(FileName);//获取扩展名
            string SaveFileName = System.IO.Path.Combine(System.Web.HttpContext.Current.Request.MapPath("up_file/"), DateTime.Now.ToString("yyyyMMddhhmm") + ExtenName);//合并两个路径为上传到服务器上的全路径

            InputFile1.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
            string url = "up_file/" + DateTime.Now.ToString("yyyyMMddhhmmss") + ExtenName; //文件保存的路径
            float FileSize = (float)System.Math.Round((float)InputFile1.ContentLength / 1024000, 1); //获取文件大小并保留小数点后一位,单位是M
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择文件!')</script>");
        }
    }
}

[其他解释]
     Brettle.Web.NeatUpload.dll已经放到bin文件下了.VS2008和本地IIS7.5都能调通,就是放到公司测试环境的IIS6上不行.
------其他解决方案--------------------


    工程是从csdn下载的:http://download.csdn.net/detail/jarry42/2665678.我不知道怎么上传附件,就放地址了.谁能分享个NeatUpload的能在IIS6上运行的工程吗?

[其他解释]
   太冷清了.究竟需要多少分才有人解答?哎
[其他解释]
     谢谢以上几位的解答.公司的网站都是外包出去的,公司熟悉建网的人几乎没有.不知道该问谁.我自己在这公司主要工作也不是维护网站.所以很郁闷.看到上面几位都是很晚或很早抽空回答,让我这个一下班就去玩的人情何以堪.向大家学习.
[其他解释]
   我看到你在web.config的httpModules里面也注册了Brettle.Web.NeatUpload这个模块,理论上说如果系统找不到这个文件的话,会先报web.config设置错误。但是你现在报的是页面错误,这比较可疑。
你检查下到底web.config为什么没有报错(你可以随便在里面乱写一点东西看是否报错)
-------------------------------------------------
    我在web.config里乱加代码,IIS6确实依然报网页错误.
[其他解释]
     哈哈,问题解决了.原来是我没有把改程序加到应用程序池里去,加上就好了.
     再次感谢下jshi123,要说你在深圳我一定请你吃饭.其他人的提示也很好,只是还没一一试探,用jshi123的提示就OK了.我得多深入学习as.net,希望以后也能像诸位一样帮别人解除困惑http://download.csdn.net/detail/jarry42/2665678这个程序真的很好,IIS6和IIs7.5上都能运行.
  

热点排行