惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
量子位
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
B
Blog RSS Feed
宝玉的分享
宝玉的分享
Security Latest
Security Latest
小众软件
小众软件
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
博客园_首页
美团技术团队
T
Tailwind CSS Blog
The Cloudflare Blog
爱范儿
爱范儿
L
LINUX DO - 热门话题
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
V
Vulnerabilities – Threatpost
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
阮一峰的网络日志
阮一峰的网络日志
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Schneier on Security
I
Intezer
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Scott Helme
Scott Helme
S
SegmentFault 最新的问题
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
Schneier on Security
Schneier on Security
Jina AI
Jina AI
N
News and Events Feed by Topic
C
Cisco Blogs
L
Lohrmann on Cybersecurity
V
V2EX
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cisco Talos Blog
Cisco Talos Blog
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
O
OpenAI News
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - FredGrit

WPF ContentControl Template WPF DatagridTemplate Binding DataTemplate WPF TreeView explicitly given key name to HierarchicalDataTemplate WPF, parse XMlDocument as List WPF two separated datagrid scroll synchronously both in horizontal and vertical via behavior WPF ContentControl Template is ControlTemplate, ContentTemplate is DataTemplate and must assign value to Content explicitly WPF TreeView show WCF config file WPF itemscontrol loaded downloaded data from WCF via httpclient WPF TreeView HierarchicalDataTemplate DataTemplate, Enum get enum name WPF consume xml generated by WCF , C# deserialize xml to List WPF implemented ICommand and IDisposable WPF ContextMenu,MenuItem command can binding to datacontext's command directly WPF usercontrol pass contextmenu command via implemented Freezable class which does not attach on Visual tree, then invoked in caller MVVM WPF consume data generate by WCF and save via ContextMenu Command in MVVM C# export List<T> to excel file via EPPlus WPF ContextMenu does not rely on host visual tree, the Freezable can exist independently, convey dependency property in usercontrol to caller C# JsonConvert DeserializeObject MissingMemberHandling.Ignore when the source model is completed and the required is partial Freezable objects do not require attachment to the WPF visual tree, maintain a persistent lifetime, and serve as a reliable binding relay between a detached ContextMenu and its parent host control. C# run httplistener to act as service application asynchronously in console, semaphoreslim allow the max concurrent number WPF Microsoft.Xaml.Behaviors.WPF, EventTrigger EventName="PreviewMouseDown" the tunnel event, while the MouseDown can't trigger the command because it was swallowed WPF customize command implemented ICommand, volatile read method is thread safe, preventing cpu and comipler reorder and optimization. WPF ItemsControl load huge 50M+ data WPF consume data generated by WCF periodically in json format WPF customize command based on ICommand and manually trigger WPF consume data generated by grpc services C# produce and consume data via Google.Protobuf WCF produce message and WPF consume periodically via DispatcherTimer WCF deconstruct WebConfig includes bindings, behaviors, service, endpoint ,serviceHostingEnvironment C# insert data into SQLite in batch periodically WPF SQLite SQLiteStudio WPF customize MultiSelectComboBox based on combobox WPF DataGrid Context menu binding command and commandparameter to datacontext WCF set fixed port as http://localhost:8888/ via Project /Properties/web/project url to create virtual directory WPF customize datagrid behavior based on behavior&lt;datagrid&gt; with command and command parameter WPF Microsoft Visual Studio XAML designer is busy WCF WebHttpBinding support both http and https WCF support basicHttpBinding and webHttpBinding - FredGrit WCF TestClient set fixed configuration file WPF consume http json and update periodically via DispatcherTimer WPF Prism.Core version 9.0.537 implemented navigation register singleton with splash screen, pass global variable via RegisterSingleton method WPF render periodically via DispatcherTimer, customize behavior - FredGrit WPF call webHttpBinding from WCF WCF binding webHttpBinding is used to web browser in json format both in request and response WPF invoke WCF dll periodically via DispatcherTimer WCF webHttpBinding is open for web browser and wpf WPF DataTemplateSelector WPF DataGrid customize behavior with multiple commands and command parameters then invoke in mvvm WPF DataGrid behavior customize command and command parameter then invoke and implemented in MVVM WPF ItemsControl customize behavior and save all items WCF service can be accessed by browser WPF WCF produce data as service and WPF consume data as client periodically WPF GRPC and Probuf generated data as service then consume by wpf periodically WPF customize behavior based on Microsoft.Xaml.Behaviors.Wpf with command and commandparameter WPF call data from CPP wrapper dll via CLI\CLR - FredGrit WPF customize behavior WPF get gpu information via System.Management WPF ItemsControl IsItemsHost=True WPF Customize behavior and dependency property command C# Serilog, Serilog.Sinks.Console, Serilog.Sinks.File C# Serilog both in file and console Windows powershell view huge file via command C# serialize huge data more than 100M via splitting into batch and concatenating as one big json file WPF WeakReference C# serialize datetime then deserialize, print lose precision. resolve by ToString(&quot;o&quot;) C# produce data and send via WebSocket as service, Python,Flask,HTML as consumer invoke periodically C# write generated data service and sent via websocket, then consume by python periodically C# DateTime print precision to microseconds C# WebSocket console as service provide data, another console as client,send request periodically C# WebAPI [HttpGet(&quot;{cnt}&quot;] pass argument WPF implement ICommand with async execute WPF ListBox control virtualization in mvvm WPF Data Source invoke from web api C# WebAPI
Python cosume WCF service via requests in json format
FredGrit · 2026-05-12 · via 博客园 - FredGrit
python -m pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple
import requests
from datetime import datetime
import time

API_URL="http://localhost:55548/GetBooksList"

def get_books(count:int):
    try:
        params={"cnt":count}
        response=requests.get(API_URL,params=params)
        response.raise_for_status()
        books=response.json()
        print(f'{datetime.now()},retrieve {len(books)} books')
        return books
    
    except requests.exceptions.RequestException as ex:
        print(f'{datetime.now()},ex:{ex}')
        return None
    
if __name__=='__main__':
    while True:
        books_list=get_books(10)
        if books_list:
            for a in books_list:
                print(a)
        time.sleep(5)
2026-05-12 14:03:53.072911,retrieve 10 books
{'Id': 571, 'Author': 'Author_571', 'Abstract': 'Abstract_571', 'Name': 'Name_571', 'ISBN': 'ISBN_571', 'Title': 'Title_571', 'Topic': 'Topic_571', 'Comment': 'Comment_571', 'Content': 'Content_571', 'Summary': 'Summary_571'}
{'Id': 572, 'Author': 'Author_572', 'Abstract': 'Abstract_572', 'Name': 'Name_572', 'ISBN': 'ISBN_572', 'Title': 'Title_572', 'Topic': 'Topic_572', 'Comment': 'Comment_572', 'Content': 'Content_572', 'Summary': 'Summary_572'}
{'Id': 573, 'Author': 'Author_573', 'Abstract': 'Abstract_573', 'Name': 'Name_573', 'ISBN': 'ISBN_573', 'Title': 'Title_573', 'Topic': 'Topic_573', 'Comment': 'Comment_573', 'Content': 'Content_573', 'Summary': 'Summary_573'}
{'Id': 574, 'Author': 'Author_574', 'Abstract': 'Abstract_574', 'Name': 'Name_574', 'ISBN': 'ISBN_574', 'Title': 'Title_574', 'Topic': 'Topic_574', 'Comment': 'Comment_574', 'Content': 'Content_574', 'Summary': 'Summary_574'}
{'Id': 575, 'Author': 'Author_575', 'Abstract': 'Abstract_575', 'Name': 'Name_575', 'ISBN': 'ISBN_575', 'Title': 'Title_575', 'Topic': 'Topic_575', 'Comment': 'Comment_575', 'Content': 'Content_575', 'Summary': 'Summary_575'}
{'Id': 576, 'Author': 'Author_576', 'Abstract': 'Abstract_576', 'Name': 'Name_576', 'ISBN': 'ISBN_576', 'Title': 'Title_576', 'Topic': 'Topic_576', 'Comment': 'Comment_576', 'Content': 'Content_576', 'Summary': 'Summary_576'}
{'Id': 577, 'Author': 'Author_577', 'Abstract': 'Abstract_577', 'Name': 'Name_577', 'ISBN': 'ISBN_577', 'Title': 'Title_577', 'Topic': 'Topic_577', 'Comment': 'Comment_577', 'Content': 'Content_577', 'Summary': 'Summary_577'}
{'Id': 578, 'Author': 'Author_578', 'Abstract': 'Abstract_578', 'Name': 'Name_578', 'ISBN': 'ISBN_578', 'Title': 'Title_578', 'Topic': 'Topic_578', 'Comment': 'Comment_578', 'Content': 'Content_578', 'Summary': 'Summary_578'}
{'Id': 579, 'Author': 'Author_579', 'Abstract': 'Abstract_579', 'Name': 'Name_579', 'ISBN': 'ISBN_579', 'Title': 'Title_579', 'Topic': 'Topic_579', 'Comment': 'Comment_579', 'Content': 'Content_579', 'Summary': 'Summary_579'}
{'Id': 580, 'Author': 'Author_580', 'Abstract': 'Abstract_580', 'Name': 'Name_580', 'ISBN': 'ISBN_580', 'Title': 'Title_580', 'Topic': 'Topic_580', 'Comment': 'Comment_580', 'Content': 'Content_580', 'Summary': 'Summary_580'}
2026-05-12 14:03:58.083683,retrieve 10 books
{'Id': 581, 'Author': 'Author_581', 'Abstract': 'Abstract_581', 'Name': 'Name_581', 'ISBN': 'ISBN_581', 'Title': 'Title_581', 'Topic': 'Topic_581', 'Comment': 'Comment_581', 'Content': 'Content_581', 'Summary': 'Summary_581'}
{'Id': 582, 'Author': 'Author_582', 'Abstract': 'Abstract_582', 'Name': 'Name_582', 'ISBN': 'ISBN_582', 'Title': 'Title_582', 'Topic': 'Topic_582', 'Comment': 'Comment_582', 'Content': 'Content_582', 'Summary': 'Summary_582'}
{'Id': 583, 'Author': 'Author_583', 'Abstract': 'Abstract_583', 'Name': 'Name_583', 'ISBN': 'ISBN_583', 'Title': 'Title_583', 'Topic': 'Topic_583', 'Comment': 'Comment_583', 'Content': 'Content_583', 'Summary': 'Summary_583'}
{'Id': 584, 'Author': 'Author_584', 'Abstract': 'Abstract_584', 'Name': 'Name_584', 'ISBN': 'ISBN_584', 'Title': 'Title_584', 'Topic': 'Topic_584', 'Comment': 'Comment_584', 'Content': 'Content_584', 'Summary': 'Summary_584'}
{'Id': 585, 'Author': 'Author_585', 'Abstract': 'Abstract_585', 'Name': 'Name_585', 'ISBN': 'ISBN_585', 'Title': 'Title_585', 'Topic': 'Topic_585', 'Comment': 'Comment_585', 'Content': 'Content_585', 'Summary': 'Summary_585'}
{'Id': 586, 'Author': 'Author_586', 'Abstract': 'Abstract_586', 'Name': 'Name_586', 'ISBN': 'ISBN_586', 'Title': 'Title_586', 'Topic': 'Topic_586', 'Comment': 'Comment_586', 'Content': 'Content_586', 'Summary': 'Summary_586'}
{'Id': 587, 'Author': 'Author_587', 'Abstract': 'Abstract_587', 'Name': 'Name_587', 'ISBN': 'ISBN_587', 'Title': 'Title_587', 'Topic': 'Topic_587', 'Comment': 'Comment_587', 'Content': 'Content_587', 'Summary': 'Summary_587'}
{'Id': 588, 'Author': 'Author_588', 'Abstract': 'Abstract_588', 'Name': 'Name_588', 'ISBN': 'ISBN_588', 'Title': 'Title_588', 'Topic': 'Topic_588', 'Comment': 'Comment_588', 'Content': 'Content_588', 'Summary': 'Summary_588'}
{'Id': 589, 'Author': 'Author_589', 'Abstract': 'Abstract_589', 'Name': 'Name_589', 'ISBN': 'ISBN_589', 'Title': 'Title_589', 'Topic': 'Topic_589', 'Comment': 'Comment_589', 'Content': 'Content_589', 'Summary': 'Summary_589'}
{'Id': 590, 'Author': 'Author_590', 'Abstract': 'Abstract_590', 'Name': 'Name_590', 'ISBN': 'ISBN_590', 'Title': 'Title_590', 'Topic': 'Topic_590', 'Comment': 'Comment_590', 'Content': 'Content_590', 'Summary': 'Summary_590'}
2026-05-12 14:04:03.097868,retrieve 10 books
{'Id': 591, 'Author': 'Author_591', 'Abstract': 'Abstract_591', 'Name': 'Name_591', 'ISBN': 'ISBN_591', 'Title': 'Title_591', 'Topic': 'Topic_591', 'Comment': 'Comment_591', 'Content': 'Content_591', 'Summary': 'Summary_591'}
{'Id': 592, 'Author': 'Author_592', 'Abstract': 'Abstract_592', 'Name': 'Name_592', 'ISBN': 'ISBN_592', 'Title': 'Title_592', 'Topic': 'Topic_592', 'Comment': 'Comment_592', 'Content': 'Content_592', 'Summary': 'Summary_592'}
{'Id': 593, 'Author': 'Author_593', 'Abstract': 'Abstract_593', 'Name': 'Name_593', 'ISBN': 'ISBN_593', 'Title': 'Title_593', 'Topic': 'Topic_593', 'Comment': 'Comment_593', 'Content': 'Content_593', 'Summary': 'Summary_593'}
{'Id': 594, 'Author': 'Author_594', 'Abstract': 'Abstract_594', 'Name': 'Name_594', 'ISBN': 'ISBN_594', 'Title': 'Title_594', 'Topic': 'Topic_594', 'Comment': 'Comment_594', 'Content': 'Content_594', 'Summary': 'Summary_594'}
{'Id': 595, 'Author': 'Author_595', 'Abstract': 'Abstract_595', 'Name': 'Name_595', 'ISBN': 'ISBN_595', 'Title': 'Title_595', 'Topic': 'Topic_595', 'Comment': 'Comment_595', 'Content': 'Content_595', 'Summary': 'Summary_595'}
{'Id': 596, 'Author': 'Author_596', 'Abstract': 'Abstract_596', 'Name': 'Name_596', 'ISBN': 'ISBN_596', 'Title': 'Title_596', 'Topic': 'Topic_596', 'Comment': 'Comment_596', 'Content': 'Content_596', 'Summary': 'Summary_596'}
{'Id': 597, 'Author': 'Author_597', 'Abstract': 'Abstract_597', 'Name': 'Name_597', 'ISBN': 'ISBN_597', 'Title': 'Title_597', 'Topic': 'Topic_597', 'Comment': 'Comment_597', 'Content': 'Content_597', 'Summary': 'Summary_597'}
{'Id': 598, 'Author': 'Author_598', 'Abstract': 'Abstract_598', 'Name': 'Name_598', 'ISBN': 'ISBN_598', 'Title': 'Title_598', 'Topic': 'Topic_598', 'Comment': 'Comment_598', 'Content': 'Content_598', 'Summary': 'Summary_598'}
{'Id': 599, 'Author': 'Author_599', 'Abstract': 'Abstract_599', 'Name': 'Name_599', 'ISBN': 'ISBN_599', 'Title': 'Title_599', 'Topic': 'Topic_599', 'Comment': 'Comment_599', 'Content': 'Content_599', 'Summary': 'Summary_599'}
{'Id': 600, 'Author': 'Author_600', 'Abstract': 'Abstract_600', 'Name': 'Name_600', 'ISBN': 'ISBN_600', 'Title': 'Title_600', 'Topic': 'Topic_600', 'Comment': 'Comment_600', 'Content': 'Content_600', 'Summary': 'Summary_600'}
2026-05-12 14:04:08.110344,retrieve 10 books
{'Id': 601, 'Author': 'Author_601', 'Abstract': 'Abstract_601', 'Name': 'Name_601', 'ISBN': 'ISBN_601', 'Title': 'Title_601', 'Topic': 'Topic_601', 'Comment': 'Comment_601', 'Content': 'Content_601', 'Summary': 'Summary_601'}
{'Id': 602, 'Author': 'Author_602', 'Abstract': 'Abstract_602', 'Name': 'Name_602', 'ISBN': 'ISBN_602', 'Title': 'Title_602', 'Topic': 'Topic_602', 'Comment': 'Comment_602', 'Content': 'Content_602', 'Summary': 'Summary_602'}
{'Id': 603, 'Author': 'Author_603', 'Abstract': 'Abstract_603', 'Name': 'Name_603', 'ISBN': 'ISBN_603', 'Title': 'Title_603', 'Topic': 'Topic_603', 'Comment': 'Comment_603', 'Content': 'Content_603', 'Summary': 'Summary_603'}
{'Id': 604, 'Author': 'Author_604', 'Abstract': 'Abstract_604', 'Name': 'Name_604', 'ISBN': 'ISBN_604', 'Title': 'Title_604', 'Topic': 'Topic_604', 'Comment': 'Comment_604', 'Content': 'Content_604', 'Summary': 'Summary_604'}
{'Id': 605, 'Author': 'Author_605', 'Abstract': 'Abstract_605', 'Name': 'Name_605', 'ISBN': 'ISBN_605', 'Title': 'Title_605', 'Topic': 'Topic_605', 'Comment': 'Comment_605', 'Content': 'Content_605', 'Summary': 'Summary_605'}
{'Id': 606, 'Author': 'Author_606', 'Abstract': 'Abstract_606', 'Name': 'Name_606', 'ISBN': 'ISBN_606', 'Title': 'Title_606', 'Topic': 'Topic_606', 'Comment': 'Comment_606', 'Content': 'Content_606', 'Summary': 'Summary_606'}
{'Id': 607, 'Author': 'Author_607', 'Abstract': 'Abstract_607', 'Name': 'Name_607', 'ISBN': 'ISBN_607', 'Title': 'Title_607', 'Topic': 'Topic_607', 'Comment': 'Comment_607', 'Content': 'Content_607', 'Summary': 'Summary_607'}
{'Id': 608, 'Author': 'Author_608', 'Abstract': 'Abstract_608', 'Name': 'Name_608', 'ISBN': 'ISBN_608', 'Title': 'Title_608', 'Topic': 'Topic_608', 'Comment': 'Comment_608', 'Content': 'Content_608', 'Summary': 'Summary_608'}
{'Id': 609, 'Author': 'Author_609', 'Abstract': 'Abstract_609', 'Name': 'Name_609', 'ISBN': 'ISBN_609', 'Title': 'Title_609', 'Topic': 'Topic_609', 'Comment': 'Comment_609', 'Content': 'Content_609', 'Summary': 'Summary_609'}
{'Id': 610, 'Author': 'Author_610', 'Abstract': 'Abstract_610', 'Name': 'Name_610', 'ISBN': 'ISBN_610', 'Title': 'Title_610', 'Topic': 'Topic_610', 'Comment': 'Comment_610', 'Content': 'Content_610', 'Summary': 'Summary_610'}
//WCF
//D:\C\WcfService4\WcfService4\Web.config
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.8" />
    <httpRuntime targetFramework="4.8" maxRequestLength="2147483647"/>
  </system.web>
  <system.serviceModel>
      <services>
          <service name="WcfService4.BookService">
              <endpoint address=""
                        binding="webHttpBinding"
                        bindingConfiguration="WebHttpBinding_IBookSerive"
                        behaviorConfiguration="webBehavior_test"
                        contract="WcfService4.IBookService"/>
              <host>
                  <baseAddresses>
                      <add baseAddress="http://localhost:8080"/>
                  </baseAddresses>
              </host>
          </service>
      </services>

      <bindings>
          <webHttpBinding>
              <binding name="WebHttpBinding_IBookSerive"
                       maxBufferPoolSize="2147483647"
                       maxReceivedMessageSize="2147483647">
                  <readerQuotas
                      maxDepth="2147483647"
                      maxStringContentLength="2147483647"
                      maxArrayLength="2147483647"
                      maxBytesPerRead="2147483647"
                      maxNameTableCharCount="2147483647"/>
              </binding>
          </webHttpBinding>
      </bindings>
      
    <behaviors>
        <endpointBehaviors>
            <behavior name="webBehavior_test">
                <webHttp/>
            </behavior>
        </endpointBehaviors>
        
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
      
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <rewrite>
            <rules>
                <rule name="WCF Without SVC" stopProcessing="true">
                    <match url="^(.*)$"/>
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile"
                             negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                    </conditions>
                    <action type="Rewrite" url="BookService.svc/{R:1}"/>
                </rule>
            </rules>
        </rewrite>
        <directoryBrowse enabled="true"/>
    </system.webServer>
</configuration>


//D:\C\WcfService4\WcfService4\IBookService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WcfService4
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IBookService" in both code and config file together.
    [ServiceContract]
    public interface IBookService
    {
        [OperationContract]
        [WebGet(UriTemplate="GetBooksList?cnt={cnt}",RequestFormat =WebMessageFormat.Json, ResponseFormat =WebMessageFormat.Json)]
        List<Book> GetBooksList(int cnt);
    }


    [DataContract]
    public class Book
    {
        [DataMember(IsRequired = true,Order =1)]
        public long Id { get; set; }

        [DataMember(IsRequired = true, Order = 2)]
        public string Author { get; set; }

        [DataMember(IsRequired = true, Order = 3)]
        public string Abstract { get; set; }

        [DataMember(IsRequired = true, Order = 4)]
        public string Name { get; set; }

        [DataMember(IsRequired = true, Order = 5)]
        public string ISBN {  get; set; }

        [DataMember(IsRequired = true, Order = 6)]
        public string Title {  get; set; }

        [DataMember(IsRequired = true, Order = 7)]
        public string Topic {  get; set; }

        [DataMember(IsRequired =true, Order = 8)]
        public string Comment { get; set;  }

        [DataMember(IsRequired =true,Order = 9)]
        public string Content { get; set; }

        [DataMember(IsRequired =true,Order =10)]
        public string Summary {  get; set; }
    }
}


//D:\C\WcfService4\WcfService4\BookService.svc.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Threading;

namespace WcfService4
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "BookService" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select BookService.svc or BookService.svc.cs at the Solution Explorer and start debugging.
    public class BookService : IBookService
    {
        private static long idx = 0;
        private long GetIncrementIdx()
        {
            return Interlocked.Increment(ref idx);
        }

        public List<Book> GetBooksList(int cnt)
        {
            List<Book> bksList = new List<Book>();
            for (int i = 0; i < cnt; i++)
            {
                long a = GetIncrementIdx();
                bksList.Add(new Book()
                {
                    Id = a,
                    Name = $"Name_{a}",
                    ISBN = $"ISBN_{a}",
                    Comment = $"Comment_{a}",
                    Content = $"Content_{a}",
                    Summary = $"Summary_{a}",
                    Author = $"Author_{a}",
                    Abstract = $"Abstract_{a}",
                    Title = $"Title_{a}",
                    Topic = $"Topic_{a}"
                });
            }
            return bksList;
        }
    }
}