Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Silverlight访问Web服务-安全问题_Silverlight_Youtube Api_Webclient - Fatal编程技术网

从Silverlight访问Web服务-安全问题

从Silverlight访问Web服务-安全问题,silverlight,youtube-api,webclient,Silverlight,Youtube Api,Webclient,我正在尝试从Silverlight到youtube进行一个简单的网络客户端呼叫。我从微软Silverlight网站上获取了代码 代码如下: 私有无效搜索跟踪\单击(对象发送者,路由目标e) { Uri serviceUri=新Uri(“”); WebClient downloader=新的WebClient(); downloader.OpenReadCompleted+=新的OpenReadCompletedEventHandler(downloader\u OpenReadCompleted

我正在尝试从Silverlight到youtube进行一个简单的网络客户端呼叫。我从微软Silverlight网站上获取了代码

代码如下:

私有无效搜索跟踪\单击(对象发送者,路由目标e) { Uri serviceUri=新Uri(“”); WebClient downloader=新的WebClient(); downloader.OpenReadCompleted+=新的OpenReadCompletedEventHandler(downloader\u OpenReadCompleted); OpenReadAsync(serviceUri); }

    void downloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
    {
        if (e.Error == null)
        {
            Stream responseStream = e.Result;

            // Continue working with responseStream here...
        }
    }
调用失败,出现以下错误:

[System.Security.SecurityException]={System.Security.SecurityException-->System.Security.SecurityException:安全错误。 位于System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 在System.Net.Browser.BrowserHttpWebRequest.c_uDisplayClassA上。 如果我只是从浏览器中点击URL,JSON将毫无问题地返回

我正在从VS/Cassini运行应用程序,因此我认为这不是在上发现的文件系统问题

任何帮助都将不胜感激

Barry

据说,由于corssdomain访问限制,与silverlight的google api交互不可能如此容易。您需要添加一些中间WCF服务,通过该服务,您的SL应用程序将与youtube api通信