0
是否有任何理由緩存這樣的服務WebMethod,它返回一個非數據庫需要的響應?移動應用程序將使用此服務呼叫每天檢索一次代碼。假設100萬個用戶負載服務器。緩存當前設置爲一個小時。靜態值的Web服務緩存
<WebMethod(CacheDuration:=3600)> _
Public Function GetIDs() As String
Dim myArray(4) As Object
myArray(0) = New With {Key .id = "one", .name = "1", .passcode = ""}
myArray(1) = New With {Key .id = "two", .name = "2", .passcode = ""}
myArray(2) = New With {Key .id = "three", .name = "3", .passcode = ""}
myArray(3) = New With {Key .id = "four", .name = "4", .passcode = ""}
myArray(4) = New With {Key .id = "five", .name = "5", .passcode = ""}
Dim js As JavaScriptSerializer = New JavaScriptSerializer()
Dim sJSON As String = js.Serialize(myArray)
Return sJSON
End Function
作爲一個方面說明:你是雙重序列化你的返回值。 –
我明白你在說什麼,但我無法弄清楚如何在沒有這樣做的情況下獲得我想要的輸出。 –
修復了雙重序列化,以防萬一有人使用了代碼 –