asp.net声音播放无法从服务器玩 [英] asp.net SoundPlayer not playing from server

查看:217
本文介绍了asp.net声音播放无法从服务器玩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为了检查声音播放将会打出一波文件所做的简单的测试。
从本地机器上工作得很好,一旦该网站是在IIS它不播放声音(或提供任何错误)。

I have made the simplest test in order to check if SoundPlayer will play a wave file. From the local machine works just fine, once the site is on IIS it doesn't play the sounds (or give any error).

下面是code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Media;

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

        spWave = new SoundPlayer("\\\\server\\site\\wavetest.wav");
        spWave.Play();
    }
}

还有什么我需要添加到.aspx文件来得到这个工作?

Is there anything else I need to add to the .aspx file to get this to work?

还是有打很短的波形文件更简单的方法,与网页上没有显示任何媒体控制?

Or is there an easier way of playing very short wave files, without displaying any media controls on the page?

推荐答案

声音播放是不是一个aspx控制,你应该找一个Web控件,可以播放wav文件,并把你的aspx页面上。现在你玩WAV Web服务器上在IIS中您的每一次页面加载。

SoundPlayer is not an aspx control, you should find a web control which can play your wav file and put that on your aspx page. Now you play the wav on your web server in iis every time your page loads.

您可以从这里开始寻找玩网页上的wav文件:<一href=\"https://www.google.com/#hl=en&sclient=psy-ab&q=wav+aspx&oq=wav+aspx&gs_l=hp.3...3239.8053.0.8299.10.9.1.0.0.0.189.813.7j2.9.0...0.0...1c.1.7.psy-ab.G8T1tD3prbo&pbx=1&bav=on.2,or.r_cp.r_qf.&bvm=bv.44158598,d.Yms&fp=ee10efb483f174ba&biw=1032&bih=561\"相对=nofollow>谷歌:WAV ASPX

You can start here looking for playing wav files on a webpage: google: wav aspx

这篇关于asp.net声音播放无法从服务器玩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆