我在WebApplication項目中創建了一個簡單的WCF服務。WCF:不支持帶輸出參數的操作
[ServiceContract(Namespace = "http://my.domain.com/service")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService
{
[OperationContract]
public string PublishProfile(out string enrollmentId, string registrationCode)
{
enrollmentId = null;
return "Not supported";
}
建 - 一切成功編譯
那之後我試圖在瀏覽器中打開的服務,我有以下錯誤:
Operation 'PublishProfile' in contract 'MyService' specifies an 'out' or 'ref' parameter. Operations with 'out' or 'ref' parameters are not supported
我不能用' out'參數?
這裏有什麼問題?
謝謝
P.S.我使用VS2008 SP1,.NET 3.5
那只是一個很短...但也許我需要知道更多爲什麼string.Empty更好 – Budda 2011-01-07 22:14:43
更改'outed'參數的位置並沒有幫助。 – Budda 2011-01-07 22:25:28
http://codeasp.net/forums/asp-net-topics/getting-started-general-asp-net/117/ what-is-difference-between-null-vs-string-empty-vsin-c對於`string.empty`有一個很好的答案。關於你原來的問題,我真的難住你爲什麼會出錯... – VoodooChild 2011-01-08 05:36:51