2013年6月6日 星期四

SilverLight連接WCF使用SSL

1.設定Web.Config:
最基本的是wcf的package路徑要設定好,再設定相關走SSL的設定
黃色區塊是一定要注意的地方,其中有個紅底色的https,一定要記得加s才繞的過去SSL

<system.serviceModel>
<services>
<service name="XXX.WebApp.InsuranceService" behaviorConfiguration="asdf">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpBinding" contract="XXX.WebApp.IInsuranceService" />
</service>
</services>

<diagnostics>
<endToEndTracing activityTracing="true" messageFlowTracing="true" propagateActivity="true"></endToEndTracing>
</diagnostics>

<bindings>
<basicHttpBinding>
<binding name="httpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior name="asdf">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug  includeExceptionDetailInFaults="true" />

</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"  multipleSiteBindingsEnabled="false"/>
</system.serviceModel>

2.Silverlight的config
Security mode要記得設定為TransportCredenialOnly
wcf的網址路徑一定要記得+S

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IInsuranceService" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
<security mode="TransportCredentialOnly" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
<endpoint address="https://xx.com.tw/xxService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInsuranceService"
contract="ServiceReference.IInsuranceService" name="BasicHttpBinding_IInsuranceService" />

</client>
    </system.serviceModel>
</configuration>

2013年5月23日 星期四

ASP.NET 半形/全形轉換問題

客戶這邊有一個UTF-8編碼的資料,程式必須將抛出的資料由半型轉全形,
但今天客戶確發現有一個字"咏"居然變"?"

原本我們是這樣寫的:
value = Strings.StrConv(value, VbStrConv.Narrow, 0).Trim();
取得的value不管怎麼改,如編為UTF-8都還是無法顯示,

結果找到charles大大的blog
http://charlesbc.blogspot.tw/2007/03/wq.html之後

試著把LocationID改為中國簡體,結果居然可以了!
雖然我還不知道為什麼,但至少先解決了我的問題,
不知道是不是使用LocationId為0時會把原有的UTF-8編碼改掉。




2013年5月16日 星期四

SilverLight連接WCF使用Windows驗證

環境: Windows Server 2008 R2
1.伺服器的"驗證"必須將Windows驗證開啟,並關閉匿名驗證。
2.設定Application為"整合式",進入進階段定後將"識別"改為Network Service。
3.設定Web.Config的<system.serviceModel>區塊

<system.serviceModel>
<services>
<service name="MT.WebApp.InsuranceService" behaviorConfiguration="asdf">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpBinding" contract="MT.WebApp.IInsuranceService" />
</service>
</services>

<diagnostics>
<endToEndTracing activityTracing="true" messageFlowTracing="true" propagateActivity="true"></endToEndTracing>
</diagnostics>

<bindings>
<basicHttpBinding>
<binding name="httpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior name="asdf">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
<serviceDebug  includeExceptionDetailInFaults="true" />

</behavior>
</serviceBehaviors>
</behaviors>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"  multipleSiteBindingsEnabled="false"/>
</system.serviceModel>

4.設定Silver config檔。

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IInsuranceService" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
<security mode="TransportCredentialOnly" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
<endpoint address="http://localhost/WebETOS/InsuranceService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInsuranceService"
                contract="ServiceReference.IInsuranceService" name="BasicHttpBinding_IInsuranceService" />

</client>
    </system.serviceModel>
</configuration>


2012年4月15日 星期日

整裝待發!!種玉米!!

這一天是3/4,我們準備要種玉米了.
這就是傳說中的玉米種子,長的超怪~乾扁扁的!

和貝貝出發整田去!!

和貝貝的媽努力整田中,我還真的很不會用鋤頭咧~

開始放玉米的種子囉~ 等下和貝貝亂丟中!!

請記得現在的樣子,下個月就會是下下一張的樣子了.

一個月後回來看,已經都長高囉~當然平時都是阿姨在澆水啦!!
看他們都長高了,超有成就感的耶!!

一個月後,我站在同一個地方,他們都長高茁壯了,
唯一不變的是~~它們真的長的亂七八糟的耶..哈哈哈!!!!

這是本次要中的西瓜苖,不管今年賣西瓜的計畫能不能完成,
我們都要讓它長出來,因為~~夏天就是西瓜,西瓜就是夏天呀!!!


就長這個樣子! 超酷,以後可以長超大顆的那種.

這張叫~~ 拼命與命令!!

學習整西瓜田中!!!