2013年10月7日月曜日

WCFをBasic通信で行うために

・IISに基本認証を設定する

 認証→基本認証を有効にする
 ※基本認証がない場合は、役割の追加→サービスの追加→基本認証を追加する。

・web.configの書き換え

 Bindingのこの辺を書き換え 
  <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Basic"/>
    <message clientCredentialType="UserName"/>
  </security>

・app.configも書き換え(こんな感じに)
  <system.serviceModel>
  <bindings>
   <basicHttpBinding>
    <binding name="BasicHttpBinding_Taurus" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="819200" maxArrayLength="1638400"
       maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <security mode="TransportCredentialOnly">
      <transport clientCredentialType="Basic" proxyCredentialType="None" realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
     </security>

    </binding>
   </basicHttpBinding>
  </bindings>


※参照
10行でズバリ

2013年10月2日水曜日

Active Reportを含むプロジェクトをTFSでビルド

active reportをインストールした端末にtfsをインストールしないとできなさそう。
・active reportをインストール
・それぞれのプロジェクトにlicxファイルを追加
・TFSのビルド定義で
  1.プロセス→3.詳細→MSBuildプラットフォームをX86
  2.エージェントの設定にactive reportをインストールした端末のエージェントを設定

※追記
TFSをインストールしているサーバーにActive Reportsをインストールするには
ライセンスが必要になるので、すでにActive Reportsをインストールしている
開発PCをTFSのビルドエージェントとして登録すると、サーバーにActive Reportsを
インストールしなくてすむ。

2013年8月20日火曜日

IISの要求制限緩和

windows 2008 R2のIIS(7.5?)のデフォルトは30,000,000byte。
編集する場合は、該当のアプリケーションの要求フィルター→ウィンドウの右側にある機能設定の編集から。

追記:windows 2008 server (IIS7.0)の場合は、AppCmd.exeで構築する

CD %windir%\system32\inetsrv
appcmd set config /section:requestfiltering /requestlimits.maxallowedcontentlength:30000000

[参照]

2013年7月5日金曜日

maxStringContentLength

アプリケーションルートのweb.configに以下のように追記する。
<configuration>
<system.serviceModel>
  <bindings>
   <basicHttpBinding>
    <binding>
     <readerQuotas maxStringContentLength="1000000" />
    </binding>
   </basicHttpBinding>
  </bindings>
</system.serviceModel>
</configuration>

2013年5月22日水曜日

64bit OS でIISを32bit稼働させる方法

アプリケーションプールの詳細設定を開き、32ビットアプリケーションの有効化をtrueにする。

2013年5月21日火曜日

.NET Framework 3.5 WCF HTTP Activation を有効にしたときのエラー

「アセンブリ ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ から型 ‘System.ServiceModel.Activation.HttpModule’ を読み込めませんでした。」

と表示される。

http://msdn.microsoft.com/ja-jp/library/aa751852.aspx
—–以下、抜粋—–
.NET Framework 4 がインストールされている場合に、.NET Framework 3.5 WCF HTTP Activation を有効にすると、このエラーが発生します。この問題を解決するには、Visual Studio 2010 コマンド プロンプト内から次のコマンドを実行します。
aspnet_regiis.exe -i -enable
——————-


つまり

cd "C:\Windows\Microsoft.NET\Framework\v4.0.30319"

aspnet_regiis.exe -i -enable

--------------------------------------------------------------------
Microsoft(R) ASP.NET IIS 登録ツール バージョン 4.0.30319.17929
ローカル コンピューターの ASP.NET をインストールおよびアンインストールするための管理ユーティリティで
す。
Copyright(C) Microsoft Corporation.  All rights reserved.
ASP.NET (4.0.30319.17929) のインストールを開始します。
..........
ASP.NET (4.0.30319.17929) のインストールが完了しました。
--------------------------------------------------------------------


こうしないといけない。

2013年5月15日水曜日

SoapFormatterのシリアライズ、デシリアライズ

SoapFormatterは[Serialization]を付けたクラスの
メンバ変数をSOAP形式にシリアライズしてくれる。

デシリアライズするとき、Assembly.Load()で見つかるアセンブリを
ロードしてデシリアライズするため、exeの階層に必要なアセンブリを配置する必要がある。