Quantcast
Channel: Windows Mobile – .NET Compact Framework (VB, C#) フォーラム
Viewing all articles
Browse latest Browse all 80

WebRequest.Create().GetResponseでSystem.UriFormatExceptionが発生する

$
0
0

はじめまして。

現在、WindowsMobileアプリケーションの開発を行っているのですが表題のエラーが発生致して困っております。

詳細は下記になります。

 

【環境】

VisualStudio2008

NET Compact Framework 3.5

JPN Windows Mobile 6 Professional Emulator

 

【コード】

//Program.cs

using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Net;

namespace SmartDeviceProject1
{
    static class Program
    {
        static void webreq()
        {
            WebRequest.Create("http://www.microsoft.com/ja/jp/default.aspx").GetResponse();
        }

        /// <summary>
        /// アプリケーションのメイン エントリ ポイントです。
        /// </summary>
        [MTAThread]
        static void Main()
        {
            webreq(); //「'System.UriFormatException' の初回例外が System.dll で発生しました。」が出力される
            webreq(); // 同上
            webreq(); // 同上 + タイムアウト(例外発生)
        }
    }
}

 

1回目と2回目では例外が出力されているとはいえ上手く行くのに、3回目では失敗しまいます。

もし回避策/解決策等を御存知の方がおられるなら、ご教授いただければ幸いです。

よろしくお願い致します。


Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>