1

我正在尝试将当前在 Windows Server 2003 32 位和 IIS6 上运行的 ASP.NET 应用程序部署到运行 Windows Server 2008 R2 和 IIS7 的新服务器。我的应用程序使用 ASP.NET 4.0 版并且在 2003 机器上运行良好。

我的问题是:

我已经部署了应用程序,它工作正常,只是 .flv 视频没有在浏览器中播放

我已经添加了所有必需的 mime 设置,但仍然没有运气

当我尝试运行视频时,我没有收到任何错误,只是一个空白屏幕显示没有视频。

相同的配置在以前的机器上运行,并且新服务器在从较早的机器上运行时也能够播放视频。

如果您有任何解决方案,请帮助我。


我刚刚发现当我尝试运行视频时会记录一个事件错误条目。如下:

    Event code: 3005 
    Event message: An unhandled exception has occurred.
    Event time: 10/9/2012 1:07:14 PM 
    Event time (UTC): 10/9/2012 8:07:14 PM 
    Event ID: 09303bdb94d64235a5ab118955416895 
    Event sequence: 12 
    Event occurrence: 1 
    Event detail code: 0 

    Application information: 
        Application domain: /LM/W3SVC/1/ROOT/BYPL-1-129942868205521131 
        Trust level: Full 
        Application Virtual Path: /BYPL 
        Application Path: F:\BYPL_Simulator_26_Sept_2012\ 
        Machine name: BYPL-APP-SERVER 

    Process information: 
        Process ID: 2536 
        Process name: w3wp.exe 
        Account name: BYPL-APP-SERVER\Administrator 

    Exception information: 
        Exception type: HttpException 
        Exception message: Could not load type 'FLVStreaming'.
        at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean  throwOnError, Boolean ignoreCase)
        at System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type)
        at System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type)
        at System.Web.Configuration.HandlerFactoryCache..ctor(String type)
        at System.Web.HttpApplication.GetFactory(String type)
        at           System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    Request information: 
        Request URL: http://localhost/BYPL/Administrator/MeterManagement/Installation/video/634655271233125000.flv
        Request path: /BYPL/Administrator/MeterManagement/Installation/video/634655271233125000.flv 
        User host address: 127.0.0.1 
        User: bypl 
        Is authenticated: True 
        Authentication Type: Forms 
        Thread account name: BYPL-APP-SERVER\Administrator 

        Thread information: 
        Thread ID: 5 
        Thread account name: BYPL-APP-SERVER\Administrator 
        Is impersonating: False 
        Stack trace:    at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
        at System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type)
        at System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type)
        at System.Web.Configuration.HandlerFactoryCache..ctor(String type)
        at System.Web.HttpApplication.GetFactory(String type)
        at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
4

1 回答 1

0

我自己找到了答案。

我在 app_code 文件夹中添加了一个名为 FLVStreaming.cs 的文件,然后重新发布了应用程序,该文件包含以下代码:

using System.Web;
public class FLVStreaming : IHttpHandler
{   // FLV header
public FLVStreaming()
{}
public void ProcessRequest(HttpContext context)
{ try{
        int pos;
        int length;
        // Check start parameter if present
        string filename = Path.GetFileName(context.Request.FilePath);
        using (FileStream fs = new   FileStream(context.Server.MapPath(filename), FileMode.Open, FileAccess.Read, FileShare.Read))
        {
            string qs = context.Request.Params["start"];
            if (string.IsNullOrEmpty(qs))
            {
                pos = 0;
                length = Convert.ToInt32(fs.Length);
            }
            else
            {
                pos = Convert.ToInt32(qs);
                length = Convert.ToInt32(fs.Length - pos) + _flvheader.Length;
            }
            // Add HTTP header stuff: cache, content type and length        
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.Cache.SetLastModified(DateTime.Now);
            context.Response.AppendHeader("Content-Type", "video/x-flv");
            context.Response.AppendHeader("Content-Length", length.ToString());
            // Append FLV header when sending partial file
            if (pos > 0)
            {
                context.Response.OutputStream.Write(_flvheader, 0, _flvheader.Length);
                fs.Position = pos;
            }
            // Read buffer and write stream to the response stream
            const int buffersize = 16384;
            byte[] buffer = new byte[buffersize];
            int count = fs.Read(buffer, 0, buffersize);
            while (count > 0)
            {
                if (context.Response.IsClientConnected)
                {
                    context.Response.OutputStream.Write(buffer, 0, count);
                    count = fs.Read(buffer, 0, buffersize);
                }
                else
                {
                    count = -1;
                }
            }
        }
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex.ToString());
    }
}
public bool IsReusable
{   get { return true; }
}
private static byte[] HexToByte(string hexString)
{ 
    byte[] returnBytes = new byte[hexString.Length / 2];
    for (int i = 0; i < returnBytes.Length; i++)
        returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
    return returnBytes;
}
}

看起来这个文件被转换成一个 .ddl 文件,并且这个 dll 文件版本根据机器架构不匹配。

于 2012-10-30T09:41:13.360 回答