Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Phone 7 and WCF Video Service
    primarykey
    data
    text
    <p>I'm trying to implement a service that will allow users to watch and upload videos to a WCF service from a windows phone 7 client (something like youtube). Now, I have the basic implementation of the service which sends video files (.wmv) to a client which has a MediaElement implementation of the Silverlight framework (has some differences from .NET implementation of the same class). Now, whenever I try to play the video locally on the client I get a SecurityException was unhandled error. When I try to encapsulate the service call in a try/catch block the application just hangs there. Here's the code:</p> <p>Server-side:</p> <pre><code> class TransferService: ITransferService { public FileStream DownloadFile(string filename) { //string FilePath = Path.Combine(@"c:\Uploads", filename); FileStream result = File.Open(@"C:\Uploads\test.wmv", FileMode.Open, FileAccess.Read, FileShare.Read); return result; } public void UploadFile(FileStream request) { //Not yet implemented } } </code></pre> <p>Server-side(web.config):</p> <pre><code> &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;httpRuntime maxRequestLength="100240" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000" transferMode="Buffered"&gt; &lt;readerQuotas maxDepth="200000000" maxArrayLength="200000000" maxStringContentLength="200000000" maxBytesPerRead="200000000" maxNameTableCharCount="200000000"/&gt; &lt;/binding&gt; &lt;/basicHttpBinding&gt; &lt;/bindings&gt; &lt;services&gt; &lt;service name="VideoService.TransferService" behaviorConfiguration="VideoServiceTypeBehaviors" &gt; &lt;endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" /&gt; &lt;endpoint contract="VideoService.ITransferService" binding="basicHttpBinding" address="basic" /&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8080/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="VideoServiceTypeBehaviors" &gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>Client-side:</p> <pre><code> public partial class Page1 : PhoneApplicationPage { TransferServiceClient sc; public Page1() { InitializeComponent(); sc = new TransferServiceClient(); this.Loaded += new RoutedEventHandler(Page_Loaded); } void Page_Loaded(object sender, RoutedEventArgs e) { sc.DownloadFileCompleted += new EventHandler&lt;DownloadFileCompletedEventArgs&gt;(sc_DownloadFileCompleted); //I think the problem is here sc.DownloadFileAsync("test.wmv"); } void sc_DownloadFileCompleted(object sender, DownloadFileCompletedEventArgs e) { myMediaElement.SetSource(e.Result); myMediaElement.Play(); } </code></pre> <p>Client-side(ServiceReference.clientconfig):</p> <pre><code>&lt;configuration&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="BasicHttpBinding_ITransferService" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00" maxBufferSize="210005536" maxReceivedMessageSize="210005536" textEncoding="utf-8"&gt; &lt;security mode="None" /&gt; &lt;/binding&gt; &lt;binding name="BasicHttpBinding_ITransferService1" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"&gt; &lt;security mode="None" /&gt; &lt;/binding&gt; &lt;/basicHttpBinding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;endpoint address="http://localhost:53163/TransferService.svc/basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITransferService1" contract="TransferService.ITransferService" name="BasicHttpBinding_ITransferService" /&gt; &lt;/client&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>Any help or insight would be much appreciated. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload