{"id":20295,"date":"2019-06-18T08:10:05","date_gmt":"2019-06-17T23:10:05","guid":{"rendered":"https:\/\/agrimo.jp\/wp\/?page_id=20295"},"modified":"2019-06-25T11:00:54","modified_gmt":"2019-06-25T02:00:54","slug":"3-windows-communication-foundation%e3%80%80%ef%bc%88%e3%83%9e%e3%82%a4%e3%82%af%e3%83%ad%e3%82%bd%e3%83%95%e3%83%88%e9%80%9a%e4%bf%a1%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%ef%bc%89","status":"publish","type":"page","link":"https:\/\/agrimo.jp\/wp\/?page_id=20295","title":{"rendered":"3.Windows Communication Foundation\u3000\uff08\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u901a\u4fe1\u30e9\u30a4\u30d6\u30e9\u30ea\uff09"},"content":{"rendered":"<p>\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u306e\u901a\u4fe1\u7528\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308b Windows Communication Foundation \uff08\u4ee5\u4e0b\u3001WCF\u3068\u7565\u3057\u307e\u3059\uff09\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>WCF\u306f\u5f93\u6765\u306e\u30bd\u30b1\u30c3\u30c8\u901a\u4fe1\u306b\u6bd4\u3079\u3066\u3001\u3088\u308a\u8cea\u306e\u9ad8\u3044\u901a\u4fe1\u304c\u884c\u3048\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002WCF\u306e\u57fa\u672c\u7684\u306a\u6982\u5ff5ABC\uff08\u30a2\u30c9\u30ec\u30b9\u3001\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3001\u30b3\u30f3\u30c8\u30e9\u30af\u30c8\uff09\u306b\u3064\u3044\u3066\u306f\u3001\u8272\u3093\u306a\u30b5\u30a4\u30c8\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u3053\u3067\u306f\u7701\u7565\u3057\u3001\u5177\u4f53\u7684\u306b\u3069\u306e\u3088\u3046\u306b\u3057\u3066\u30a2\u30d7\u30ea\u5185\u3078\u7d44\u307f\u8fbc\u3080\u306e\u304b\u3092\u30b5\u30f3\u30d7\u30eb\u3092\u4ea4\u3048\u3066\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30b0\u30ea\u30e2\u306e\u88fd\u54c1\u3067\u306f\u3001\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u3001\u3072\u304b\u308a\u96fb\u8a71CTI\u3001\u65e5\u5831\u691c\u7d22\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\uff13\u3064\u306e\u88fd\u54c1\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u9593\u306e\u901a\u4fe1\u7528\u3068\u3057\u3066\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u4e3b\u306a\u7528\u9014\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u3068DB\u53c2\u7167\u3067\u3059\u3002<\/p>\n<p>\u30b5\u30fc\u30d0\u30fc\u3068\u306a\u308b\u30d1\u30bd\u30b3\u30f3\u306b\u306f\u3001WCF\u3092\u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066\u3001\u30a2\u30d7\u30ea\u3068\u306f\u72ec\u7acb\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306b\u3059\u308b\u7406\u7531\u306f\u3001WCF\u306f\u7ba1\u7406\u8005\u30e2\u30fc\u30c9\u3067\u306a\u3044\u3068\u8d77\u52d5\u3067\u304d\u306a\u3044\u70b9\u306b\u3042\u308a\u307e\u3059\u3002\u30a2\u30d7\u30ea\u3092\u8d77\u52d5\u3059\u308b\u5ea6\u306b\u7ba1\u7406\u8005\u6a29\u9650\u306e\u8981\u6c42\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u3066\u306f\u3001\u30a2\u30d7\u30ea\u3068\u3057\u3066\u306f\u5c11\u3005\u554f\u984c\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\uff11\uff0e\u4ee5\u4e0b\u306f\u3001\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u306e\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002\u8d64\u67a0\u5185\u306f\u3001Windows\u30b5\u30fc\u30d3\u30b9\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff08SmartConnectService_FAX\uff09\u3068WCF\u30b5\u30fc\u30d3\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\uff08SmartConnectServiceLibrary_FAX\uff09\u3001\u305d\u308c\u306b\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\uff08Setup_SmartConnectService\uff09\u3067\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20435\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h18_18-1.png 1362w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff12\uff0e\u307e\u305a\u6700\u521d\u306bWCF\u30b5\u30fc\u30d3\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20439\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h41_49.png 1363w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff13\uff0e\u65b0\u898f\u306e\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306bWCF\u30b5\u30fc\u30d3\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u91cd\u8981\u306a\u306e\u306f\u3001App.config\u3001IService1.cs\u3001Service1.cs \u306e3\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20441\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_00.png 1363w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">App.config \u306f\u3001\u53f3\u30af\u30ea\u30c3\u30af\u3057\u3066\u300cWCF\u69cb\u6210\u306e\u7de8\u96c6\u300d\u3067\u958b\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20442\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h48_50.png 1366w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">\u8a2d\u5b9a\u3059\u3079\u304d\u3068\u3053\u308d\u306f\u3001\u300c\u30b5\u30fc\u30d3\u30b9\u300d\u306e\u4e2d\u306e\u300c\u30db\u30b9\u30c8\u300d\u3068\u3001\u305d\u306e\u4e0b\u306e\u300c\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u300d\u3067\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20443\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15-1024x546.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_15.png 1362w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20444\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h49_24.png 1361w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">\u300c\u30db\u30b9\u30c8\u300d\u306f\u3001\u300c\u30d9\u30fc\u30b9\u30a2\u30c9\u30ec\u30b9\u300d\u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\">\u521d\u671f\u5024\u306f\u3001http:\/\/localhost:8733\/Design_Time_Addresses\/WcfServiceLibrary1\/Service1\/\u3000\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u300c\u7de8\u96c6\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001\u81ea\u8eab\u306e\u30b7\u30b9\u30c6\u30e0\u306b\u5408\u3046\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20446\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05-1024x546.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_03h57_05.png 1361w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">\u300c\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u300d\u306f\u3001\u300c\uff08\u7a7a\u767d\u306e\u540d\u524d\uff09\u300d\u3068\u3044\u3046\u306e\u304c\uff12\u3064\u3042\u308a\u307e\u3059\u304c\u3001\u4e0a\u306e\u65b9\uff08Address\u304cmex\u3067\u306a\u3044\u65b9\uff09\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u65b9\u5f0f\u3068\u30b3\u30f3\u30c8\u30e9\u30af\u30c8\u3092\u81ea\u8eab\u306e\u30b7\u30b9\u30c6\u30e0\u306b\u5408\u3046\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20447\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h02_54.png 1361w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\uff14\uff0eIService1.cs\u3001Service1.cs \u306b\u3064\u3044\u3066\u306f\u3001\u524d\u8005\u304c\u30b5\u30fc\u30d3\u30b9\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u306e\u3088\u3046\u306a\u3082\u306e\u3001\u5f8c\u8005\u304c\u30b5\u30fc\u30d3\u30b9\u306e\u4e2d\u8eab\u3068\u3044\u3063\u305f\u611f\u3058\u3067\u3059\u3002\u8aac\u660e\u3059\u308b\u3088\u308a\u898b\u305f\u65b9\u304c\u65e9\u3044\u306e\u3067\u3001\u5b9f\u969b\u306e\u30bd\u30fc\u30b9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"ISmartConnectServiceLibrary.cs\">using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Serialization;\r\nusing System.ServiceModel;\r\nusing System.Text;\r\n\r\nnamespace SmartConnectService_FAX_Library\r\n{\r\n    \/\/ \u30e1\u30e2: [\u30ea\u30d5\u30a1\u30af\u30bf\u30fc] \u30e1\u30cb\u30e5\u30fc\u306e [\u540d\u524d\u306e\u5909\u66f4] \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30b3\u30fc\u30c9\u3068 config \u30d5\u30a1\u30a4\u30eb\u306e\u4e21\u65b9\u3067\u540c\u6642\u306b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u540d \"IService1\" \u3092\u5909\u66f4\u3067\u304d\u307e\u3059\u3002\r\n    [ServiceContract]\r\n    public interface ISmartConnectService_FAXLibrary\r\n    {\r\n        [OperationContract]\r\n        Stream GetStream(string filePath);\r\n\r\n        [OperationContract]\r\n        void SetString(string filePath);\r\n\r\n        [OperationContract]\r\n        bool Del_File(string filePath);\r\n\r\n        [OperationContract]\r\n        string SetStream(Stream stream);\r\n\r\n        [OperationContract]\r\n        string[] get_fileList(string path, string pattern);\r\n\r\n        [OperationContract]\r\n        Responce_DB get_DataTable_from_select_DB(string sql);\r\n\r\n        [OperationContract]\r\n        int exec_nonquery(string name);\r\n\r\n        [OperationContract]\r\n        ItemInfo GetItem();\r\n\r\n        [OperationContract]\r\n        void SetItem(ItemInfo item);\r\n\r\n        [OperationContract]\r\n        RemoteFileInfo DownloadFile(DownloadRequest request);\r\n\r\n        [OperationContract]\r\n        void UploadFile(RemoteFileInfo request);\r\n    }\r\n\r\n    [DataContract]\r\n    public class ItemInfo\r\n    {\r\n        private string _username = \"\";\r\n        private string _mydocument = \"\";\r\n        private string _appdata = \"\";\r\n        private string _machinename = \"\";\r\n\r\n        [DataMember]\r\n        public string UserName\r\n        {\r\n            get { return _username; }\r\n            set { _username = value; }\r\n        }\r\n\r\n        [DataMember]\r\n        public string MyDocument\r\n        {\r\n            get { return _mydocument; }\r\n            set { _mydocument = value; }\r\n        }\r\n\r\n        [DataMember]\r\n        public string AppData\r\n        {\r\n            get { return _appdata; }\r\n            set { _appdata = value; }\r\n        }\r\n\r\n        [DataMember]\r\n        public string MachineName\r\n        {\r\n            get { return _machinename; }\r\n            set { _machinename = value; }\r\n        }\r\n    }\r\n\r\n    [DataContract]\r\n    public class Responce_DB\r\n    {\r\n        private string _err_message = \"\";\r\n        private DataTable _data_table = null;\r\n\r\n        [DataMember]\r\n        public string Err_Message\r\n        {\r\n            get { return _err_message; }\r\n            set { _err_message = value; }\r\n        }\r\n\r\n        [DataMember]\r\n        public DataTable Data_Table\r\n        {\r\n            get { return _data_table; }\r\n            set { _data_table = value; }\r\n        }\r\n    }\r\n\r\n    [MessageContract]\r\n    public class DownloadRequest\r\n    {\r\n        [MessageBodyMember]\r\n        public string FileName;\r\n    }\r\n\r\n    [MessageContract]\r\n    public class RemoteFileInfo : IDisposable\r\n    {\r\n        [MessageHeader(MustUnderstand = true)]\r\n        public string FileName;\r\n\r\n        [MessageHeader(MustUnderstand = true)]\r\n        public long Length;\r\n\r\n        [MessageBodyMember(Order = 1)]\r\n        public System.IO.Stream FileByteStream;\r\n\r\n        public void Dispose()\r\n        {\r\n            if (FileByteStream != null)\r\n            {\r\n                FileByteStream.Close();\r\n                FileByteStream = null;\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<pre class=\"lang:default decode:true \" title=\"SmartConnectServiceLibrary.cs\">using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.SqlServerCe;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Serialization;\r\nusing System.ServiceModel;\r\nusing System.ServiceModel.Activation;\r\nusing System.Text;\r\n\r\nnamespace SmartConnectService_FAX_Library\r\n{\r\n    \/\/ \u30e1\u30e2: [\u30ea\u30d5\u30a1\u30af\u30bf\u30fc] \u30e1\u30cb\u30e5\u30fc\u306e [\u540d\u524d\u306e\u5909\u66f4] \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30b3\u30fc\u30c9\u3068 config \u30d5\u30a1\u30a4\u30eb\u306e\u4e21\u65b9\u3067\u540c\u6642\u306b\u30af\u30e9\u30b9\u540d \"Service1\" \u3092\u5909\u66f4\u3067\u304d\u307e\u3059\u3002\r\n    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]\r\n    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]\r\n    public class SmartConnectService_FAXLibrary : ISmartConnectService_FAXLibrary\r\n    {\r\n        public Stream GetStream(string filePath)\r\n        {\r\n            try\r\n            {\r\n                FileStream imageFile = File.OpenRead(filePath);\r\n                return imageFile;\r\n            }\r\n            catch (IOException ex)\r\n            {\r\n                throw ex;\r\n            }\r\n        }\r\n\r\n        public bool Del_File(string filePath)\r\n        {\r\n            try\r\n            {\r\n                File.Delete(filePath);\r\n                return true;\r\n            }\r\n            catch\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n        static string _filePath = \"\";\r\n        public void SetString(string filePath)\r\n        {\r\n            _filePath = filePath;\r\n        }\r\n\r\n        public string SetStream(Stream stream)\r\n        {\r\n            FileStream outstream = File.Open(_filePath, FileMode.Create, FileAccess.Write);\r\n            CopyStream(stream, outstream);\r\n            outstream.Close();\r\n            stream.Close();\r\n\r\n            return _filePath;\r\n        }\r\n\r\n        static void CopyStream(System.IO.Stream instream, System.IO.Stream outstream)\r\n        {\r\n            const int bufferLen = 4096;\r\n            byte[] buffer = new byte[bufferLen];\r\n            int count = 0;\r\n            int bytecount = 0;\r\n            while ((count = instream.Read(buffer, 0, bufferLen)) &gt; 0)\r\n            {\r\n                outstream.Write(buffer, 0, count);\r\n                Console.Write(\".\");\r\n                bytecount += count;\r\n            }\r\n        }\r\n\r\n        public string[] get_fileList(string path, string pattern)\r\n        {\r\n            return Directory.GetFiles(path, pattern);\r\n        }\r\n\r\n        public int exec_nonquery(string sql)\r\n        {\r\n            int ret_value = -1;\r\n\r\n            SqlCeConnection conn = new SqlCeConnection(\"Data Source=\" + info.AppData + \"\\\\AGRIMO.JP\\\\\u3072\u304b\u308aFAX\u96fb\u8a71CTI\\\\hd_fax_cti.sdf\");\r\n            conn.Open();\r\n\r\n            SqlCeTransaction tx = conn.BeginTransaction();\r\n            SqlCeCommand cmd = conn.CreateCommand();\r\n            cmd.Transaction = tx;\r\n\r\n            try\r\n            {\r\n                cmd.CommandText = sql;\r\n                ret_value = cmd.ExecuteNonQuery();\r\n\r\n                tx.Commit();\r\n            }\r\n            catch\r\n            {\r\n                tx.Rollback();\r\n            }\r\n            finally\r\n            {\r\n                conn.Close();\r\n            }\r\n\r\n            return ret_value;\r\n        }\r\n\r\n        public Responce_DB get_DataTable_from_select_DB(string sql)\r\n        {\r\n            SqlCeConnection conn = new SqlCeConnection(\"Data Source=\" + info.AppData + \"\\\\AGRIMO.JP\\\\\u3072\u304b\u308aFAX\u96fb\u8a71CTI\\\\hd_fax_cti.sdf\");\r\n            conn.Open();\r\n\r\n            DataSet wDs = new DataSet();\r\n\r\n            try\r\n            {\r\n                using (SqlCeDataAdapter da = new SqlCeDataAdapter(sql, conn))\r\n                {\r\n                    da.Fill(wDs);\r\n                    da.Dispose();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new Responce_DB\r\n                {\r\n                    Data_Table = null,\r\n                    Err_Message = ex.Message\r\n                };\r\n            }\r\n            finally\r\n            {\r\n                conn.Close();\r\n            }\r\n\r\n            return new Responce_DB\r\n            {\r\n                Data_Table = wDs.Tables[0],\r\n                Err_Message = \"\"\r\n            };\r\n        }\r\n\r\n        static ItemInfo info = new ItemInfo();\r\n\r\n        public void SetItem(ItemInfo item)\r\n        {\r\n            info = item;\r\n        }\r\n\r\n        public ItemInfo GetItem()\r\n        {\r\n            return info;\r\n        }\r\n\r\n        public RemoteFileInfo DownloadFile(DownloadRequest request)\r\n        {\r\n            RemoteFileInfo result = new RemoteFileInfo();\r\n            try\r\n            {\r\n                \/\/ get some info about the input file\r\n                string filePath = System.IO.Path.Combine(info.MyDocument + \"\\\\Hikari FAX Denwa CTI\\\\\", request.FileName);\r\n                System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);\r\n\r\n                \/\/ check if exists\r\n                if (!fileInfo.Exists) throw new System.IO.FileNotFoundException(\"File not found\", request.FileName);\r\n\r\n                \/\/ open stream\r\n                System.IO.FileStream stream = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);\r\n\r\n                \/\/ return result\r\n                result.FileName = request.FileName;\r\n                result.Length = fileInfo.Length;\r\n                result.FileByteStream = stream;\r\n            }\r\n            catch\r\n            {\r\n\r\n            }\r\n            return result;\r\n        }\r\n\r\n        public void UploadFile(RemoteFileInfo request)\r\n        {\r\n            FileStream targetStream = null;\r\n            Stream sourceStream = request.FileByteStream;\r\n\r\n            string uploadFolder = info.MyDocument + \"\\\\Hikari FAX Denwa CTI\\\\\";\r\n            string filePath = Path.Combine(uploadFolder, request.FileName);\r\n\r\n            using (targetStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None))\r\n            {\r\n                \/\/read from the input stream in 6K chunks\r\n                \/\/and save to output stream\r\n                const int bufferLen = 65000;\r\n                byte[] buffer = new byte[bufferLen];\r\n                int count = 0;\r\n                while ((count = sourceStream.Read(buffer, 0, bufferLen)) &gt; 0)\r\n                {\r\n                    targetStream.Write(buffer, 0, count);\r\n                }\r\n                targetStream.Close();\r\n                sourceStream.Close();\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\uff15\uff0e\u6b21\u306b\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u5185\u306b\u300cWindows\u30b5\u30fc\u30d3\u30b9(.NET Framework)\u300d\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20460\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_04h31_52.png 1365w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff16\uff0e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306e Service1.cs \u3092\u958b\u3044\u3066\u3001\u53f3\u30af\u30ea\u30c3\u30af\u3057\u3066\u300c\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u30fc\u306e\u8ffd\u52a0\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20475\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h17_36.png 1367w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 160px;\">\u2193<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20476\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h18_32.png 1364w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff17\uff0e\u300cserviceProcessInstaller1\u300d\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u958b\u3044\u3066\u3001\u300cAccount\u300d\u3092\u300cLocalSystem\u300d\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20478\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09-1024x546.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h23_09.png 1362w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff18\uff0e\u300cserviceInstaller1\u300d\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u958b\u3044\u3066\u3001\u300cDelayedAutoStart\u300d\u3092\u300cTrue\u300d\u3001\u300cStartType\u300d\u3092\u300cAutomatic\u300d\u306b\u305d\u308c\u305e\u308c\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20487\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h25_23-1.png 1361w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff19\uff0eApp.config \u3092\u524a\u9664\u3057\u3001\u65b0\u305f\u306bWCF\u30b5\u30fc\u30d3\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\uff08\u4f8b\u306e\u5834\u5408\u306f\u3001WcfServiceLibrary1\uff09\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306eApp.config\u3078\u306e\u30ea\u30f3\u30af\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20468\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40-1024x545.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h45_40.png 1363w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 80px;\">\u2193\u3000\u5143\u306eApp.config \u3092\u524a\u9664<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20469\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18-300x161.png\" alt=\"\" width=\"300\" height=\"161\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18-300x161.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18-1024x549.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18-820x440.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h49_18.png 1362w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 80px;\">\u2193\u3000WCF\u30b5\u30fc\u30d3\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\uff08\u4f8b\u306e\u5834\u5408\u306f\u3001WcfServiceLibrary1\uff09\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306eApp.config \u3092<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20470\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14-300x161.png\" alt=\"\" width=\"300\" height=\"161\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14-300x161.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14-1024x548.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14-820x439.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h50_14.png 1363w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 80px;\">\u2193\u3000\u30ea\u30f3\u30af\u3068\u3057\u3066\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20472\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25-300x159.png\" alt=\"\" width=\"300\" height=\"159\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25-300x159.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25-1024x544.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_12h51_25.png 1366w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\uff11\uff10\uff0eService1.cs \u3092\u30b3\u30fc\u30c9\u3067\u958b\u3044\u3066\u3001\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\uff08\u203b\u30b5\u30f3\u30d7\u30eb\u306f\u3001\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u30b9\u30de\u30fc\u30c8\u30b3\u30cd\u30af\u30c8\u306e\u3082\u306e\u3067\u3059\u3002\u30b5\u30fc\u30d3\u30b9\u304c\u958b\u59cb\u3059\u308b\u6642\u306b\u306f\u3001\u4f7f\u7528\u3059\u308b\u30dd\u30fc\u30c8\u3092\u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u8a2d\u5b9a\u3067\u30aa\u30fc\u30d7\u30f3\u306b\u3057\u3001\u30b5\u30fc\u30d3\u30b9\u304c\u30b9\u30c8\u30c3\u30d7\u3059\u308b\u6642\u306b\u306f\u30af\u30ed\u30fc\u30ba\u3057\u3066\u3044\u307e\u3059\u3002\u203bCOM\u306e NetFwTypeLib.dll \u53c2\u7167\u304c\u5fc5\u8981\u3067\u3059\u3002\uff09<\/p>\n<pre class=\"lang:default decode:true\" title=\"Service1.cs\u3000\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\">using System;\r\nusing System.ServiceProcess;\r\nusing System.ServiceModel;\r\nusing SmartConnectService_FAX_Library;\r\nusing NetFwTypeLib;\r\n\r\nnamespace SmartConnectService_FAX\r\n{\r\n    public partial class SmartConnectService : ServiceBase\r\n    {\r\n        ServiceHost m_host = null;\r\n\r\n        public SmartConnectService()\r\n        {\r\n            InitializeComponent();\r\n            ServiceName = \"SmartConnectService_FAX\";\r\n        }\r\n\r\n        protected override void OnStart(string[] args)\r\n        {\r\n            OnStop();\r\n\r\n            m_host = new ServiceHost(typeof(SmartConnectService_FAXLibrary));\r\n            if (null != m_host)\r\n            {\r\n                m_host.Open();\r\n            }\r\n\r\n            \/\/\u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u8a2d\u5b9a\u306b\u30eb\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b\r\n            add_rule();\r\n        }\r\n\r\n        protected override void OnStop()\r\n        {\r\n            if (null != m_host)\r\n            {\r\n                m_host.Close();\r\n                m_host = null;\r\n            }\r\n\r\n            \/\/\u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u8a2d\u5b9a\u306e\u30eb\u30fc\u30eb\u3092\u524a\u9664\u3059\u308b\r\n            remove_rule();\r\n        }\r\n\r\n\r\n        \/\/\u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u8a2d\u5b9a\u306b\u30eb\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b\r\n        private void add_rule()\r\n        {\r\n            \/\/ Create the FwPolicy2 object.\r\n            Type NetFwPolicy2Type = Type.GetTypeFromProgID(\"HNetCfg.FwPolicy2\", false);\r\n            INetFwPolicy2 fwPolicy2 = (INetFwPolicy2)Activator.CreateInstance(NetFwPolicy2Type);\r\n\r\n            \/\/ Get the Rules object\r\n            INetFwRules RulesObject = fwPolicy2.Rules;\r\n\r\n            int CurrentProfiles = fwPolicy2.CurrentProfileTypes;\r\n\r\n            \/\/ Create a Rule Object.\r\n            Type NetFwRuleType = Type.GetTypeFromProgID(\"HNetCfg.FWRule\", false);\r\n            INetFwRule NewRule = (INetFwRule)Activator.CreateInstance(NetFwRuleType);\r\n\r\n            NewRule.Name = \"\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u30b9\u30de\u30fc\u30c8\u30b3\u30cd\u30af\u30c8\";\r\n            NewRule.Description = \"\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u30b9\u30de\u30fc\u30c8\u30b3\u30cd\u30af\u30c8\";\r\n            \/\/NewRule.ApplicationName = System.Windows.Forms.Application.ExecutablePath;\r\n\r\n            NewRule.Protocol = (int)NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP;\r\n            NewRule.LocalPorts = \"55315\";\r\n            NewRule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN;\r\n            NewRule.Enabled = true;\r\n            NewRule.Grouping = \"@firewallapi.dll,-23255\";\r\n            NewRule.Profiles = CurrentProfiles;\r\n            NewRule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;\r\n\r\n            \/\/\u540c\u4e00\u306e\u30eb\u30fc\u30eb\u540d\u304c\u3042\u308c\u3070\u524a\u9664\u3059\u308b\r\n            RulesObject.Remove(NewRule.Name);\r\n            \/\/\u65b0\u3057\u304f\u30eb\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b\r\n            RulesObject.Add(NewRule);\r\n        }\r\n\r\n        \/\/\u30d5\u30a1\u30a4\u30e4\u30fc\u30a6\u30a9\u30fc\u30eb\u8a2d\u5b9a\u306e\u30eb\u30fc\u30eb\u3092\u524a\u9664\u3059\u308b\r\n        private void remove_rule()\r\n        {\r\n            \/\/ Create the FwPolicy2 object.\r\n            Type NetFwPolicy2Type = Type.GetTypeFromProgID(\"HNetCfg.FwPolicy2\", false);\r\n            INetFwPolicy2 fwPolicy2 = (INetFwPolicy2)Activator.CreateInstance(NetFwPolicy2Type);\r\n\r\n            \/\/ Get the Rules object\r\n            INetFwRules RulesObject = fwPolicy2.Rules;\r\n\r\n            \/\/\u30eb\u30fc\u30eb\u540d\u3067\u524a\u9664\u3059\u308b\r\n            RulesObject.Remove(\"\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u30b9\u30de\u30fc\u30c8\u30b3\u30cd\u30af\u30c8\");\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\uff11\uff11\uff0eProjectInstaller.cs \u3092\u30b3\u30fc\u30c9\u3067\u958b\u3044\u3066\u3001\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\uff08\u203b\u30b5\u30f3\u30d7\u30eb\u306f\u3001\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u30b9\u30de\u30fc\u30c8\u30b3\u30cd\u30af\u30c8\u306e\u3082\u306e\u3067\u3059\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u76f4\u5f8c\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u81ea\u52d5\u958b\u59cb\u3057\u307e\u3059\u3002\uff09<\/p>\n<pre class=\"lang:default decode:true \" title=\"ProjectInstaller.cs\u3000\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\">using System.Collections;\r\nusing System.ComponentModel;\r\n\r\nnamespace SmartConnectService_FAX\r\n{\r\n    [RunInstaller(true)]\r\n    public partial class ProjectInstaller : System.Configuration.Install.Installer\r\n    {\r\n        public ProjectInstaller()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        public override void Commit(IDictionary mySavedState)\r\n        {\r\n            base.Commit(mySavedState);\r\n\r\n            \/\/\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u76f4\u5f8c\u81ea\u52d5\u958b\u59cb \r\n            System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController();\r\n            sc.ServiceName = \"SmartConnectService_FAX\";\r\n            sc.Start();\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\uff11\uff12\uff0e\u4ee5\u4e0a\u304c\u51fa\u6765\u305f\u3089\u3001\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u5b8c\u6210\u3067\u3059\u3002\uff08\u203b\u4ee5\u4e0b\u306f\u3001\u3072\u304b\u308aFAX\u96fb\u8a71CTI\u30b9\u30de\u30fc\u30c8\u30b3\u30cd\u30af\u30c8\u306e\u753b\u9762\u3067\u3059\u3002\uff09<\/p>\n<p style=\"padding-left: 40px;\">\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20485\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29-300x159.png\" alt=\"\" width=\"300\" height=\"159\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29-300x159.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29-1024x544.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29-820x436.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-20_13h42_29.png 1364w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">\u30ab\u30b9\u30bf\u30e0\u52d5\u4f5c\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20681\" src=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04-300x160.png\" alt=\"\" width=\"300\" height=\"160\" srcset=\"https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04-300x160.png 300w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04-1024x546.png 1024w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04-50x27.png 50w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04-820x437.png 820w, https:\/\/agrimo.jp\/wp\/wp-content\/uploads\/2019\/06\/2019-06-25_10h59_04.png 1364w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\uff11\uff13\uff0e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089WCF\u30b5\u30fc\u30d3\u30b9\u3092\u901a\u3058\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u306eDB\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4ee5\u4e0b\u306b\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089WCF\u30b5\u30fc\u30d3\u30b9\u3078\u306e\u30a2\u30af\u30bb\u30b9\u30b5\u30f3\u30d7\u30eb\">using System;\r\nusing System.Data;\r\nusing System.ServiceModel;\r\nusing System.Windows.Forms;\r\n\r\nnamespace Hikari_FAX_Denwa_CTI_Client\r\n{\r\n    class CtiServerDB\r\n    {\r\n        public SmartConnectServiceReference.ISmartConnectService_FAXLibraryChannel proxy = null;\r\n\r\n        public CtiServerDB()\r\n        {\r\n            \/\/WCF\u30b5\u30fc\u30d3\u30b9\u306b\u63a5\u7d9a\u3059\u308b\r\n            EndpointAddress endPoint\r\n                = new EndpointAddress(\r\n                    \"http:\/\/\" + svr_addr\r\n                    + \":55315\/SmartConnectService_FAX_Library.SmartConnectService_FAXLibrary\");\r\n\r\n            BasicHttpBinding httpBind = new BasicHttpBinding();\r\n            httpBind.MaxReceivedMessageSize = 2147483647;\r\n            httpBind.SendTimeout = TimeSpan.Parse(\"00:10:00\");\r\n            httpBind.TransferMode = TransferMode.Streamed;\r\n\r\n            proxy = ChannelFactory&lt;SmartConnectServiceReference.ISmartConnectService_FAXLibraryChannel&gt;.CreateChannel(httpBind, endPoint);\r\n        }\r\n\r\n        public int exec_nonquery(string sql)\r\n        {\r\n            return proxy.exec_nonquery(sql);\r\n        }\r\n\r\n        public DataTable query(string sql)\r\n        {\r\n            SmartConnectServiceReference.Responce_DB rdb = proxy.get_DataTable_from_select_DB(sql);\r\n            return rdb.Data_Table;\r\n        }\r\n\r\n        public void close()\r\n        {\r\n            proxy.Close();\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u306e\u901a\u4fe1\u7528\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308b Windows Communication Foundation \uff08\u4ee5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-20295","page","type-page","status-publish","hentry"],"wppr_data":{"cwp_meta_box_check":"No"},"_links":{"self":[{"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=\/wp\/v2\/pages\/20295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20295"}],"version-history":[{"count":46,"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=\/wp\/v2\/pages\/20295\/revisions"}],"predecessor-version":[{"id":20683,"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=\/wp\/v2\/pages\/20295\/revisions\/20683"}],"wp:attachment":[{"href":"https:\/\/agrimo.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}