Web サービスを検討したことがありますか? これらは、HTTP リクエストを送信できるほぼすべての言語で使用できます。クライアント アプリケーションを制御できる場合は、Web サービスが間違いなく正しいルートです。
http://sarangasl.blogspot.com/2010/09/create-simple-web-service-in-visual.html
編集:
http応答コードを使用して、バイトの単純なhttpアップロードを検討しましたか。つまり、HTTP OK、HTTP 失敗です。ステータス コードは、プロジェクトに合わせてカスタマイズできます。
編集2:
おそらく、応答として HTTP ステータス コードのみを使用する RPC スタイルのメソッドが適している可能性があります。この質問のヒントを確認します。C# での json 呼び出し
基本的に、何らかの文字列を URL に送信し、ステータス コードを受信するだけです。それは非常に最小限です。
編集3:
これは、Reflector を使用していくつかの古いコードから取り出したものです。これは、手順の一般的な要点です。明らかに、最初のリクエストには using ステートメントが必要です。
public void SMS(Uri address, string data)
{
// Perhaps string data is JSON, or perhaps its something delimited who knows.
// Json seems to be the pretty lean.
try
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(address);
request.Method = "POST";
// If we don't setup proxy information then IE has to resolve its current settings
// and adds 500+ms to the request time.
request.Proxy = new WebProxy();
request.Proxy.IsBypassed(address);
request.ContentType = "application/json;charset=utf-8";
// If your only sending two bits of data why not add custom headers?
// If you only send headers, no need for the StreamWriter.
// request.Headers.Add("SMS-Sender","234234223");
// request.Headers.Add("SMS-Body","Hey mom I'm keen for dinner tonight :D");
request.Headers.Add("X-Requested-With", "XMLHttpRequest");
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.WriteLine(data);
writer.Close();
using (HttpWebResponse response = (HttpWebResponse) request.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
// Either read the stream or get the status code and description.
// Perhaps you won't even bother reading the response stream or the code
// and assume success if no HTTP error status causes an exception.
}
}
}
catch (WebException exception)
{
if (exception.Status == WebExceptionStatus.ProtocolError)
{
// Something,perhaps a HTTP error is used for a failed SMS?
}
}
}
Http ステータス コードと説明のみで応答することを忘れないでください。また、IE プロキシを解決する時間を節約するために、要求元の URL をバイパスするように要求のプロキシが設定されていることを確認してください。