3
當我嘗試舉辦一個WCF服務,在Windows完美的作品,在單控制檯應用程序,我得到以下錯誤(*):運行在Mac Os託管在單控制檯應用程序中的WCF服務X
字典中已存在具有相同鍵的元素。
我不明白爲什麼會發生這種情況,或者我需要考慮解決這個問題。任何經歷過這樣的事情,或者能夠指引我走向正確的方向?
我在運行Os X 10.6.8的Mac上使用Mono 2.10.8。
*堆棧跟蹤:
at System.Collections.ObjectModel.KeyedCollection`2[System.Type,System.ServiceModel.Description.IOperationBehavior].InsertItem (Int32 index, IOperationBehavior item) [0x0003a] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/corlib/System.Collections.ObjectModel/KeyedCollection.cs:168
at System.Collections.Generic.KeyedByTypeCollection`1[System.ServiceModel.Description.IOperationBehavior].InsertItem (Int32 index, IOperationBehavior kind) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.Collections.Generic/KeyedByTypeCollection.cs:70
at System.Collections.ObjectModel.Collection`1[System.ServiceModel.Description.IOperationBehavior].Add (IOperationBehavior item) [0x0000c] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs:74
at System.ServiceModel.Description.ContractDescriptionGenerator.GetOrCreateOperation (System.ServiceModel.Description.ContractDescription cd, System.Reflection.MethodInfo mi, System.Reflection.MethodInfo serviceMethod, System.ServiceModel.OperationContractAttribute oca, System.Type asyncReturnType, Boolean isCallback, System.Type givenServiceType) [0x00511] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs:350
at System.ServiceModel.Description.ContractDescriptionGenerator.FillOperationsForInterface (System.ServiceModel.Description.ContractDescription cd, System.Type exactContractType, System.Type givenServiceType, Boolean isCallback) [0x00131] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs:240
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContractInternal (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback) [0x001ed] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs:190
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType, System.Type serviceTypeForCallback) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs:136
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type givenContractType, System.Type givenServiceType) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs:131
at System.ServiceModel.Description.ContractDescriptionGenerator.GetContract (System.Type contractType) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs:101
at System.ServiceModel.Description.ContractDescription.GetContract (System.Type contractType) [0x00017] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs:66
at System.ServiceModel.ServiceHost.AddServiceEndpoint (System.Type implementedContract, System.ServiceModel.Channels.Binding binding, System.Uri address, System.Uri listenUri) [0x00022] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs:96
at System.ServiceModel.ServiceHost.AddServiceEndpoint (System.Type implementedContract, System.ServiceModel.Channels.Binding binding, System.Uri address) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs:85
at ConsoleApplication3.Program.Main (System.String[] args) [0x0002b] in /Users/steven/Software/ABC Cloud/NooSphere/Mono.Host/Main.cs:16
我已經能夠得到的代碼的一個子集運行,但由於到代碼庫的複雜性我並不真正知道這個非常普遍的錯誤的確切原因。似乎有很多問題導致了這一點,包括(i)對WCF服務發現的不完全支持,(ii)服務契約遺傳怪異以及(iii)不支持的azure庫。我正在調查此問題,並會報告我找到的任何解決方案。 – dsfgsho 2012-03-10 19:58:01
我已經提交了https://bugzilla.xamarin.com/show_bug.cgi?id=6187這看起來與您的問題類似。你有繼承的操作行爲(如WebGet)嗎? – sisve 2012-07-19 10:02:43
是的,我做到了。我通過將所有操作轉換爲一個服務合同來解決這個問題。 – dsfgsho 2012-07-20 17:27:19