這一篇,我們看一下.net core如何創建WebService,首先創建一個.net core的web應用。
項目創建好以后,需要通過NuGet加入SoapCore
新建一個類,用於返回和接收參數
[
[
報錯信息:
FaultException:The maxinum string content length quota(8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader .Line 1,position135
解決:在.net Core項目中startup.cs文件的Configure方法中
var binging = new BasicHttpBinding();
binging.ReaderQuotas.MaxStringContentLength = int.MaxValue;
app.UseSoapEndpoint<IContract>(
"/StudentService.asmx", binging, SoapSerializer.XmlSerializer);