2012年5月23日
App.config(アプリケーション構成ファイル)に下記設定を行う。
ホスト(http://www.yahoo.co.jp)の最大接続数を4にその他のホストの最大接続数を2にする例
<configuration>
<system.net>
<connectionManagement>
<add address = “http://www.yahoo.co.jp” maxconnection = “4″ />
<add address = “*” maxconnection = “2″ />
</connectionManagement>
</system.net>
</configuration>
プログラムで設定するにはServicePointManagerクラスを使用する。
<configuration> <system.net> <connectionManagement> <add address = “http://www.contoso.com” maxconnection = “4″ /> <add address = “*” maxconnection = “2″ /> </connectionManagement> </system.net> </configuration>
2012年5月7日
Visual Studio 2010 sp1の場合、セットアップファイル設定時にレジストリのキー
Software\Microsoft\Office\Outlook\Addins\[Addinの名前]
下にあるManifestの値を確認し、
TARGETDIR]MSSCP.InfoProtect.MailChecker2010.vsto|vstolocal
だった場合は「file:///」を追加し、
file:///[TARGETDIR]MSSCP.InfoProtect.MailChecker2010.vsto|vstolocal
に変更する。
2011年4月25日
Power Shellのinvoke-expressionでパスに空白を含む実行ファイルにパラメータを指定して実行する方法。
invoke-expression “& ‘C:\Program Files\sample\sample.exe’ param1 param2 param3″
2011年4月12日
CommandManager.InvalidateRequerySuggested();
を実行して、RequerySuggestedイベントを強制的に発生させてCanExecuteが実行されるようにできる。
UIスレッドと別スレッドから呼び出すときはDispatcher.Invoke()やDispatcher.BeginInvokeのデリゲートから呼び出す。
2011年4月9日
WebRequestの最大同時接続数を変更するにはでプログラムから変更する方法をメモしたが、設定ファイルでも変更する方法は以下。
app.configに下記の設定を追加する。
<system.net>
<connectionManagement>
<add address=”*” maxconnection=”20″/>
</connectionManagement>
</system.net>
2011年4月5日
WebRequest クラスの最大同時接続数のデフォルト値は2のため、
複数のサイトに動じアクセスする場合は変更する必要がある。
変更するには
System.Net.ServicePointManager.DefaultConnectionLimit
プロパティに設定を行えばよい。
2010年10月29日
下記のように外部スクリプトとして追加することで実行できるようになった。
var webBrowser = new WebBrowser();
HtmlElement scriptElem= webBrowser.Document.CreateElement(“Script”);
scriptElem.SetAttribute(“type”, “text/javascript”);
scriptElem.SetAttribute(“src”, http://localhost/script.js);
<Script>タグ内へinnerHtml, innerTextを使ってコードを追加できなかった。また、srcの参照先を”file:///“で始まるものにすると、実行時にエラーとなる。javascriptの関数を実行するには
object obj = webBrowser.Document.InvokeScript(“functionname”);
と記述する。第2パラメータにobjectの配列を渡すことで引数を指定することが可能。