我正在尝试将当前在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)
答案 0 :(得分: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文件版本根据计算机体系结构不匹配。