顯示具有 WCF 標籤的文章。 顯示所有文章
顯示具有 WCF 標籤的文章。 顯示所有文章

2010年3月30日 星期二

Ajax Enabled WCF Service on IIS 7 always return 404 error

最近 study 了 Ajax enabled WCF Service,覺的著實好用。於是想放到 MOSS 上。而 MOSS 是位於 Windows Server 2008 的 IIS 7 上。一試,就發現 IIS 7 執行 svc 時是正常的,但一執行 *.svc/js 就會回傳 404 (not found) 的錯誤。

然而,在 IIS 6 (windows 2003) 上不會發生這個問題。

花了一整天,都在處理這個 Issue。一度還以為是 moss 的問題。

現在終於找到了原因。在此將完整的步驟記錄下來。

  1. 建立一個 WCF Service. 並且記得要 加上[ServiceContract],[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  2. 在 config 上,使用 webHttpBinding, 並啟用 <enableWebScript/> 的 endPoint behavior
  3. 部署程式到 Windows 2008 的 IIS 7 上。此以瀏覽器輸入網址 *.svc/js 會回傳 404 錯誤
  4. 這一步就是我漏掉的。打開 IIS 管理員,找到該網站(Site),於 "處理常式對應”(Handler Mappings)上,新增一個指令對應。

要求路徑:*.svc
執行檔:%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
名稱:svc-ISAPI-2.0

       如下圖。

image

這樣一來就解決了問題。

2009年5月12日 星期二

WCF 設定:此服務的安全性設定需要 'Anonymous' 驗證,但裝載此服務的 IIS 應用程式未啟用該驗證。

老問題了。在IIS 7 又發生了如下的錯誤。

'/' 應用程式中發生伺服器錯誤。

此服務的安全性設定需要 'Anonymous' 驗證,但裝載此服務的 IIS 應用程式未啟用該驗證。

描述: 在執行目前 Web 要求的過程中發生未處理的例外情形。請檢閱堆疊追蹤以取得錯誤的詳細資訊,以及在程式碼中產生的位置。
例外詳細資訊: System.NotSupportedException: 此服務的安全性設定需要 'Anonymous' 驗證,但裝載此服務的 IIS 應用程式未啟用該驗證。

原因

*.svc檔需要 Anonymous 來讀取,以提供 wsdl。而目錄並未提供 Anonymous 的權限。

步驟

  1. 檢查目錄是否有 Network Service 的 「讀取及執行」、「列出資料夾內容」、「讀取」的權限
  2. 檢查目錄是否有 IIS_IUsrs 的 「讀取及執行」、「列出資料夾內容」、「讀取」的權限
  3. 在 IIS Manager 上檢查目錄是否有啟用「匿名驗證」

image image

更詳的步驟,參考這裡

2011/02/09: 有時,是IIS 未註冊成功的目題,請試著執行

執行"%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r –y

2011/06/09: 在 dotnet V4.0,要執行"%windir%\Microsoft.NET\Framework64\v4.0.30319\ServiceModelReg.exe" –r

2012/06/06: 在 Windows 8 的 IIS 8 上,ServiceModelReg 已被取消。所得的結果只剩下

Microsoft (R) WCF/WF registration tool version 4.5.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Administration utility that manages the installation and uninstallation of
WCF and WF components on a single machine.

[Error]This tool is not supported on this version of Windows. Administrators should instead install/uninstall Windows Communication Foundation features using the 'Turn Windows Features On/Off' dialog, or the dism command line tool.

意思是:只能使用Turn Windows Features on or of 的方式來安裝。

2009年5月6日 星期三

在 Silverlight 中使用 WCF 的心得

最近在開始才有機會使用 Silverlight. 這裡將遇到的心得寫下來,以便大家參考(當然也包括自己)
  1. Silverlight 2.0 只能使用 basicHttpBinding,尚未無法使用 wsHttpBinging。
  2. 在 Silverlight 2.0  中當作 WCF Client 呼叫 WCF Service 時,需注意到有許多特性不能使用。否則會發生則似下面的錯誤訊息。

Message: Unhandled Error in Silverlight 2 Application Unrecognized attribute 'allowCookies' in service reference configuration. Note that attribute names are case-sensitive. Note also that only a subset of the Windows Communication Foundation configuration functionality is available in Silverlight.  

其實 Visual Studio 2008 在開發時已經有提醒了,只是我沒注意到。看 config file 的 editor 畫面,有出現 blue underline 的提醒。
image

    3.  我是使用於 MOSS 的環境下,開發時會使用 http://moss/ 來存取 MOSS,而 WCF Client 在呼叫時,預設會寫成 http://moss.domain.com/ 這樣的存取方式。

<client>
 <endpoint name="BasicHttpBinding_IMyService" contract="MossServices.IMyService" binding="basicHttpBinding" address="http://epmoss.domain.com/wcf/MyService.svc" bindingconfiguration="BasicHttpBinding_IMyService" />
</client>
這樣一來,SilverLight 會以為是跨 domain 來存取 wcf,且認為是不安全的。於是又開始找 clientaccesspolicy.xml (see 讓服務可跨網域界限使用)
因此,必須手動地改成相同的 domain. 如下
<client>
  <endpoint name="BasicHttpBinding_IMyService" contract="MossServices.IMyService" binding="basicHttpBinding" address="http://epmoss/wcf/MyService.svc" bindingconfiguration="BasicHttpBinding_IMyService" />
</client>

   4.  WCF 預設無法讀取 asp.net 環境的 Context。如果需要讀取 Context,則必須做以下的改變。(參考 這裡)

第一個,是在 class 上增加[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] 的attribute

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
  public class MyService : IMyService
  {
    public string GetCurrentSiteName()
    {
      
      SPContext context = SPContext.Current;
      var q = (from SPList i in context.Web.Lists
               select i.Description).ToArray();
      return string.Join(",", q);
    }
  }

第二,是在 Web.config 上增加下列設定 (字體放大加粗的部份)。此用意在讓wcf 環境可與 asp.net 相容外,也要讓 client side 的資訊能傳到 wcf service 來。

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="myBasicBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Ntlm"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service behaviorConfiguration="MossWcfServiceLibrary.MyServiceBehavior"
        name="MossWcfServiceLibrary.MyService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="myBasicBinding"
          contract="MossWcfServiceLibrary.IMyService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MossWcfServiceLibrary.MyServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

2009年2月13日 星期五

Binding (4): Others binding elements

由上三回的說明,您大概可看出,其是 一個Binding是以數個 binding element 有順序地組成一個 stack。每一個 binding element 負責溝通的一部份功能。

Binding Binding Elements 說明
BasicHttpContextBinding
<basicHttpContextBinding>
TextMessageEncodingBindingElement, HttpTransportBindingElement 與 BasicHttpBinding 的主要差別,BasicHttpContextBinding 將 allowCookies 設為 true
MsmqIntegrationBinding

<msmqIntegrationBinding>

BinaryMessageEncodingBindingElement,
MsmqTransportBindingElement
 
NetMsmqBinding
<netMsmqBinding>
BinaryMessageEncodingBindingElement,
MsmqTransportBindingElement
 
NetPeerTcpBinding

<netPeerTcpBinding>

BinaryMessageEncodingBindingElement,
PnrpPeerResolverBindingElement,
PeerTransportBindingElement
 
WebHttpBinding

<webHttpBinding>

TextMessageEncodingBindingElement,
HttpTransportBindingElement
BasicHttpBinding 使用 SOAP 作為訊息格式,而WebHttpBinding 使用 HTTP 作為訊息格式
WSFederationHttpBinding
<wsFederationHttpBinding>
TransactionFlowBindingElement, TextMessageEncodingBindingElement, HttpTransportBindingElement  
WSHttpContextBinding

<wsHttpContextBinding>

TransactionFlowBindingElement, TextMessageEncodingBindingElement, HttpTransportBindingElement  
WS2007FederationHttpBinding
<ws2007FederationHttpBinding>
TransactionFlowBindingElement, TextMessageEncodingBindingElement, HttpTransportBindingElement  
WS2007HttpBinding

<ws2007HttpBinding>

TransactionFlowBindingElement, TextMessageEncodingBindingElement, HttpTransportBindingElement 與WsHttpBinding 相同,但使用了新版的Security, ReliableSession, 與 TransactionFlow binding elements。

Binding(3): wsDualHttpBinding

<wsDualHttpBinding>

 

<wsDualHttpBinding>
        <binding name="string"
        closeTimeout="TimeSpan"
        openTimeout="TimeSpan" 
        receiveTimeout="TimeSpan"
        sendTimeout="TimeSpan"
        bypassProxyOnLocal="Boolean"
        clientBaseAddress="URI"
        transactionFlow="Boolean" 
        hostNameComparisonMode="StrongWildCard/Exact/WeakWildcard"
        maxBufferPoolSize="integer"
        maxReceivedMessageSize="Integer"
        messageEncoding="Text/Mtom" 
        proxyAddress="URI"
                
textEncoding="Unicode/BigEndianUnicode/UTF8"
        useDefaultWebProxy="Boolean">
        <reliableSession ordered="Boolean"
            inactivityTimeout="TimeSpan" />
        <security mode="None/Message">
           <message clientCredentialType="None/Windows/UserName/Certificate/CardSpace"
                negotiateServiceCredential="Boolean"
                    algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15" />
                </security>
        <readerQuotas maxDepth="integer" 
           maxStringContentLength="integer"
           maxByteArrayContentLength="integer"
           maxBytesPerRead="integer"
           maxNameTableCharCount="integer" />
    </binding>
</wsDualHttpBinding>

 

  1. WSDualHttpBinding 除了使用了原來在 BasicHttpBinding 所使用的 TextMessageEncodingBindingElement 與 HttpTransportBindingElement 這兩個 binding element,也使用了 TransactionFlowBindingElement。
  2. 使用 CompositeDuplexBindingElement, 讓 Client 可以 callback (回呼)。為了讓 Client 可以回呼, WSDualHttpBinding 是一個雙通道的 Binding,除了一般由 Client 傳送訊息給 Service 的通道(Channel)外,另外建立一個讓Service傳送訊息給Client 的通道。
  3. 一個 Service 通常有多個 Client 會使用該Service。WSDualHttpBinding 為了回呼Client,必須保持每個 Client 的資訊,因此需要維護 Session。此時引入了ReliableSessionBindingElement。

2009年2月12日 星期四

Binding (2): netTcpBinding

netTcpBinding
<netTcpBinding>
   <binding 
      closeTimeout="TimeSpan"
     hostNameComparisonMode="StrongWildCard/Exact/WeakWildcard"
      listenBacklog="Integer"
      maxBufferPoolSize="integer"
      maxBufferSize="Integer"
      maxConnections="Integer" 
      maxReceivedMessageSize="Integer"
            name="string"
      openTimeout="TimeSpan"
      portSharingEnabled="Boolean"
      receiveTimeout="TimeSpan"
      sendTimeout="TimeSpan"
      transactionFlow="Boolean" 
      transactionProtocol="OleTransactions/WSAtomicTransactionOctober2004" 
            transferMode="Buffered/Streamed/StreamedRequest/StreamedResponse"

      <reliableSession ordered="Boolean"
            inactivityTimeout="TimeSpan"
            enabled="Boolean" />
      <security mode="None/Transport/Message/Both">
            <message clientCredentialType="None/Windows/UserName/Certificate/CardSpace"
                defaultProtectionLevel="None/Sign/EncryptAndSign" 
                     algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15" />
                        <transport clientCredentialType="None/Windows/Certificate"
                protectionLevel="None/Sign/EncryptAndSign" />
      </security>
       <readerQuotas maxDepth="integer" 
            maxStringContentLength="integer"
            maxByteArrayContentLength="integer"
            maxBytesPerRead="integer"
            maxNameTableCharCount="integer" />
   </binding>
</netTcpBinding>
  1. 當Client 是在 intranet 環境時,使用 netTcpBinding 是一個對效能最好的選擇,而且可以host 在 Windows Service 上。IIS5 或 IIS6 只能使用 HttpBinding。IIS7 則可以使用 WAS 方式來支援 netTcpBinding。
  2. netTcpBinding 使用 TCP protocol 並且完全支援 SOAP security, transactions, 與 reliability。
  3. 由於此 netTcpBinding 支援 .net 平台,因此並不適合跨平台如.NET + JAVA。我認為此將取代原本的 .net Remoting.
  4. 使用三個 binding elements. 第一個是 BinaryMessageEncodingBindingElement ,負責將訊息轉換成將來傳輸用的二進位格式。
  5. 第二個是TransactionFlowBindingElement ,只有一個 TransactionProtocol 屬性,定義交易(transactions) 如何從 clinet 流向 service。預設值是 TransactionProtocol.OleTransactions, 意思就是不支援 WS-AtomicTransaction。如果要支援 WS-AtomicTransaction,就設成 TransactionProtocol.WSAtomicTransaction11 或 TransactionProtocol.WSAtomicTransactionOctober2004。注意到需要使用 WS-AtomicTransaction 組態公用程式 (wsatConfig.exe) 來設定該台伺服器。
  6. 第三個是 TcpTransportBindingElement, 負責傳輸的工作。

2009年2月11日 星期三

Binding (1) : BasicHttpBinding

WCF 中,最複雜的,我認為應該是 Binding 了。
要選擇適當的 binding, 通常要了解一堆的 WS-* 的標準,配合客戶需求,剔除不必要的選項後,才是我們適合的 binding.

那什麼是 Binding 呢?
Binding 定義了客戶端與伺服器端的「溝通方式」,主要有下列三大類(但不限)

  1. Transport Protocol: Http, Tcp, Msmq, etc
  2. Message format: Xml, Mtom, Json, binary, etc
  3. Message protocols: Soap, WS-*, none, etc

WCF 內建提供的 Binding, 目前已達12 種了。如果都不適用,還可以自訂 CustomBinding。

那要如何選擇呢?有沒一個建議的流程呢?在 patterns & practices Improving Web Services Security Guide 中有簡略描述。以下就嘗試翻譯並整理一下!

<basicHttpBinding>
<binding
allowCookies="Boolean"
bypassProxyOnLocal="Boolean"
closeTimeout="TimeSpan"
envelopeVersion="None/Soap11/Soap12"
hostNameComparisonMode="StrongWildCard/Exact/WeakWildcard"
maxBufferPoolSize="Integer"
maxBufferSize="Integer"
maxReceivedMessageSize="Integer"
messageEncoding="Text/Mtom"
name="string"
openTimeout="TimeSpan"
proxyAddress="URI"
receiveTimeout="TimeSpan"
sendTimeout="TimeSpan"
textEncoding="UnicodeFffeTextEncoding/Utf16TextEncoding/Utf8TextEncoding"
transferMode="Buffered/Streamed/StreamedRequest/StreamedResponse"
useDefaultWebProxy="Boolean"
<security mode="None/Transport/Message/TransportWithMessageCredential/TransportCredentialOnly">
<transport clientCredentialType="None/Basic/Digest/Ntlm/Windows/Certificate"
proxyCredentialType="None/Basic/Digest/Ntlm/Windows"
realm="string" />
<message
algorithmSuite="Basic128/Basic192/Basic256/Basic128Rsa15/Basic256Rsa15/TripleDes/TripleDesRsa15/Basic128Sha256/Basic192Sha256/TripleDesSha256/Basic128Sha256Rsa15/Basic192Sha256Rsa15/Basic256Sha256Rsa15/TripleDesSha256Rsa15"
clientCredentialType="UserName/Certificate"/>
</security>
<readerQuotas maxDepth="Integer"
maxStringContentLength="Integer"
maxByteArrayContentLength="Integer"
maxBytesPerRead="Integer"
maxNameTableCharCount="Integer" />
</binding>
</basicHttpBinding>


basicHttpBinding



  1. 與 ASMX web service 相容,即WS-I Basic Profile 1.1

  2. 預設沒有實作安全相關標準。如果需要安全,則需要設定 Security.Mode。

  3. 在沒有安全性的要求下,(即 <scurity mode=’none’> 或 Security.Mode 設為 BasicHttpSecurityMode.None),basicHttpBinging使用了 TextMessageEncodingBindingElement 與 HttpTransportBindingElement 這兩個 binding element。TextMessageEncodingBindingElement 將訊息格式化為與 SOAP 相容。HttpTransportBindingElement 則將訊息以 http protocol 傳送。因此,在basicHttpBinding 中,可以看到TextMessageEncodingBindingElement 與 HttpTransportBindingElement 相關的 configuration schema.

  4. 若要使用 SSL, 即要以 HTTPS 來傳送訊息,則需設定<scurity mode=’Transport’>,此時 HttpTransportBindingElement會被 HttpsTransportBindingElement 所取代。事實上HttpsTransportBindingElement 繼承HttpTransportBindingElement,所以只有多了一些功能。

  5. BasicHttpBinding 可以使用於 IIS5 或 IIS6 上

  6. messageEncoding=”Mtom” 時,會將 TextMessageEncodingBindingElement 以 MtomMessageEncodingBindingElement 取代。MTOM 編碼方式 實作了 W3C SOAP Message Transmission Optimization Mechanism, 用於以SOAP格式傳輸 binary 資料如附件、圖片,以降低訊息的大小。


 

2009年2月9日 星期一

WCF: 使用 Header 傳遞訊息

在使用 WCF 時,自訂訊息內容自然是免不了的設計。因此使用 DataContract, 已經是 WCF 中經典中的經典了。
如果需要 WCF client 多傳一些訊息回來,就必須在Service上更改 DataContract, 然後Client 再更新程式…..

等一下,DataContract 是一個 Contract,怎麼能說改就改?
話又說回來,面對各式各樣的客戶,常常見到不同的需求需要傳遞不同的訊息。此時該怎麼辦?

原來,WCF 內建有個傳遞訊息的方法,且不需要修改 DataContract。

步驟1:修改 WCF Client 的 config。

        <client>
          <endpoint address="http://localhost:8081/test/service1.svc" binding="basicHttpBinding"
              bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
              name="BasicHttpBinding_IService1" >
            <!--  use header to pass message  -->
            <headers>
              <MyHeader xmlns="http://sample.org/test">
                This is my test data
              </MyHeader>
            </headers>
          </endpoint>
        </client>

步驟2: 修改 Service, 使用 OperationContext 讀取 header

      int myHeaderIndex = OperationContext.Current.RequestContext.RequestMessage.Headers.FindHeader("MyHeader", "http://sample.org/test");
      string result;
      if (myHeaderIndex != -1)
      {
        result = OperationContext.Current.RequestContext.RequestMessage.Headers.GetHeader(myHeaderIndex);
      }
      else
        result = OperationContext.Current.RequestContext.RequestMessage.Headers.Action;
      return string.Format("You entered: {0}, Header: {1}", value, result);

需要注意的是, Client config 中,可以傳不同的訊息,由 Service 來搜尋header。這樣一來,就不需要修改 DataContract 了。
當然,這樣也是有相當大的壞處,這樣會造成設計人員各自傳遞不同格式的訊息。假以時日,一堆不同的自訂訊息,最終難以維護。

sample download

2009年2月5日 星期四

Web Services Architecture

我個人十分喜歡 WCF。因為

  1. 可以實作出高重複使用性的元件(re-use)
  2. 依靠設定(configuration)而非程式碼。
  3. 實作出許多 WS-* 。

第三點,較難一次說完,而且WS-* 的標準也愈來愈多。
想要說服同事使用 WCF 的技術,可得花費一番功夫。

下圖是 Web Services Architecture, 是我在 2006 年聽 Web cast 時抓的圖。

Web Service Architecture

裡頭有相當多的標準我還不了解呢。使用 WCF的最大好處,就是 WCF 已經幫我們實作許多這些標準,而且隨著版本昇級,WCF也將實作更多的 WS-* 檔準。
我們需要的就是「看文件」+「設定」而已。

See also An Introduction to the Web Services Architecture and Its Specifications , Web Services Architecture

2008年3月21日 星期五

Windows integration WCF config settings

在使用WCF 之Windows 整合驗證時,一直發生問題。也很難解決 後來,原來是設定問題。拿掉下面的 proxyCredentialType 就好了。 到現在,我還是弄不懂 proxyCredentialType 是什麼意思。 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="basicBinding"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" proxyCredentialType="Windows" /> </security> </binding> </basicHttpBinding> </bindings>

2008年3月20日 星期四

此服務的安全性設定需要 Windows 驗證,但裝載此服務的 IIS 應用程式未啟用該驗證

在本機(Vista) 開發 WCF程式 ok 後,部署到 windows server 2003 後,存取 http://server/virdir/service.svc時 發生錯誤 此服務的安全性設定需要 Windows 驗證,但裝載此服務的 IIS 應用程式未啟用該驗證。 堆疊追蹤: [NotSupportedException: 此服務的安全性設定需要 Windows 驗證,但裝載此服務的 IIS 應用程式未啟用該驗證。] System.ServiceModel.Channels.HttpChannelListener.ApplyHostedContext(VirtualPathExtension virtualPathExtension, Boolean isMetadataListener) +4074379 System.ServiceModel.Activation.VirtualPathExtension.ApplyHostedContext(TransportChannelListener listener, BindingContext context) +71 ... 不知道該怎麼辦? 英文的字是這樣寫的 Security settings for this service require Windows Authentication but it isnot enabled for the IIS application that hosts this service 經google 大師指點後,查到 http://blogs.msdn.com/appsec/ in this case you will need to set windows authentication and change the iis metabase manualy On your IIS server, start Notepad, and then open the \system32\inetsrv\Metabase.xml file located on the hard disk. In the section, locate the following line: NTAuthenticationProviders="NTLM" Modify the line so that it reads exactly as follows: NTAuthenticationProviders="Negotiate,NTLM" Check also the attribute of the solution vdir at the metabse.xml. 但好像還是不夠啊!

2008年2月15日 星期五

Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

開發 WCF 的程式時,一直出現 Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.的錯誤。 目的:使用 windows authentication, 讓 intranet user 使用 windows 帳號來使用服務。 http://localhost/myservice 也是我的asp.net 2.0 網站 service url : http://localhost/myservice/service.svc 最後,在 IIS 將 service.svc 設成可以anoymous 存取,就解決了問題

2007年3月16日 星期五

於asp.net 上存取 msmq 的權限問題

最近寫了一個小程式,用來demo 在實作 soa時, 應該如何設計 web service。 所以需要以 wcf 來存取 msmq 我使用了 local computer 的 private queue 但當 wcf service 存取 msmq 時,卻發生權限的問題。 我在 wcf service 之 web.config 上,加上了具有管理權限的設定 也是不能動。(於 xp sp2 上開發) 解決方法如下:
  1. 使用 Windows 2003 的 application pool: 設該application pool 之identity
  2. xp sp2: 在msmq 之管理 snap-in上,將該 queue 之安全性,設定 computerName\aspnet 為full control (好像太多了)

後來就解決了.

2007年3月12日 星期一

Web Service Software Factory

這個東西很好用。真沒想到微軟愈來愈smart 了。 不過,要按照順序安裝以下的東西。連結到 google 找一下就有了。 Enterprise Library for .NET Framework 2.0 - January 2006 GuidanceAutomationExtensions.msi GuidanceAutomationToolkit.msi Web Service Software Factory - December 2006 (refresh).msi 要試試哦!真是好東西。

Share with Facebook