远程服务器返回错误:NotFound

时间:2013-02-06 14:40:20

标签: windows-phone-7 azure reporting-services azure-virtual-machine

我在azure上创建了一个虚拟机,并安装了带有报告服务的Sql server。我正在编写一个Windows Phone 7应用程序,它在vm的reportserver上托管的xml文件中下载报告。下面的代码不适用于我的位置(班加罗尔),但是相同的代码在我位于芬兰的同行中工作得很好。我在家里尝试了相同的代码,我没有任何代理/防火墙,但它仍无效。

稍后,当我检查虚拟机的仪表板时,它将欧洲显示为虚拟机的位置。我可能听起来很愚蠢,但这可能是个原因吗?

        var webRequest = WebRequest.Create("http://virtualmachine.cloudapp.net/Reportserver") as HttpWebRequest;

        webRequest.CookieContainer = cookies;
        webRequest.Credentials = new NetworkCredential("username", "password");

        webRequest.BeginGetResponse((i) =>
            {
                var r = i.AsyncState as WebRequest;
                var resp = r.EndGetResponse(i);
                var stream = resp.GetResponseStream();
                var reader = new StreamReader(stream);
                var content = reader.ReadToEnd();
                Console.WriteLine(content);


                // Now download report file (reportUrl) in xml format.
                var webRequest2 = WebRequest.Create(reportUrl) as HttpWebRequest;

                webRequest2.CookieContainer = cookies;
                webRequest2.BeginGetResponse((i2) =>
                    {
                        var r2 = i2.AsyncState as WebRequest;
                        var resp2 = r2.EndGetResponse(i2);
                        var stream2 = resp2.GetResponseStream();
                        var reader2 = new StreamReader(stream2);
                        var content2 = reader2.ReadToEnd();
                        Console.WriteLine(content2);
                    }, webRequest2);

            }, webRequest);

我收到以下错误: -

InnerException: System.Net.WebException
       Message=The remote server returned an error: NotFound.

0 个答案:

没有答案