Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
345e4eb0
IoTSharp
项目概览
IoTSharp
/
IoTSharp
8 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
345e4eb0
编写于
11月 03, 2019
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Upgrade to .Net Core 3.0
上级
1979d2ff
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
76 addition
and
31 deletion
+76
-31
IoTSharp.Edge.ModBus/IoTSharp.Edge.ModBus.csproj
IoTSharp.Edge.ModBus/IoTSharp.Edge.ModBus.csproj
+10
-11
IoTSharp.Edge.ModBus/Program.cs
IoTSharp.Edge.ModBus/Program.cs
+25
-7
IoTSharp.Edge.ModBus/Startup.cs
IoTSharp.Edge.ModBus/Startup.cs
+14
-12
IoTSharp.Edge.ModBus/reame.md
IoTSharp.Edge.ModBus/reame.md
+4
-1
IoTSharp.Edges.sln
IoTSharp.Edges.sln
+23
-0
未找到文件。
IoTSharp.Edge.ModBus/IoTSharp.Edge.ModBus.csproj
浏览文件 @
345e4eb0
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp
2.2
</TargetFramework>
<TargetFramework>netcoreapp
3.0
</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
...
...
@@ -20,24 +20,23 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CrystalQuartz.AspNetCore" Version="6.8.1" />
<PackageReference Include="HslCommunication" Version="6.2.5" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="2.2.0" />
<PackageReference Include="Quartz" Version="3.0.7" />
<PackageReference Include="QuartzHostedService" Version="0.0.5" />
<PackageReference Include="Quartzmin.SelfHost" Version="1.0.3" />
<PackageReference Include="System.ServiceModel.Duplex" Version="4.5.3" />
<PackageReference Include="System.ServiceModel.Http" Version="4.5.3" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.5.3" />
<PackageReference Include="System.ServiceModel.Security" Version="4.5.3" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
<PackageReference Include="QuartzHostedServiceEx" Version="0.0.7" />
<PackageReference Include="System.ServiceModel.Duplex" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.6.0" />
<PackageReference Include="System.ServiceModel.Security" Version="4.6.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IoTSharp.EdgeSdk.MQTT\IoTSharp.EdgeSdk.MQTT.csproj" />
<ProjectReference Include="..\IoTSharp.Extensions.AspNetCore\IoTSharp.Extensions.AspNetCore.csproj" />
<ProjectReference Include="..\IoTSharp.Extensions\IoTSharp.Extensions.csproj" />
</ItemGroup>
...
...
IoTSharp.Edge.ModBus/Program.cs
浏览文件 @
345e4eb0
using
IoTSharp.Extensions
;
using
IoT.Things.ModBus.Services
;
using
IoTSharp.Extensions
;
using
IoTSharp.Extensions.AspNetCore
;
using
Microsoft.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
using
QuartzHostedService
;
namespace
IoT.Things.ModBus
{
...
...
@@ -9,14 +14,27 @@ namespace IoT.Things.ModBus
{
public
static
void
Main
(
string
[]
args
)
{
Create
WebHostBuilder
(
args
).
Build
().
RunAsEnv
();
Create
HostBuilder
(
args
).
Build
().
Run
();
}
public
static
IWebHostBuilder
CreateWebHostBuilder
(
string
[]
args
)
=>
WebHost
.
CreateDefaultBuilder
(
args
)
.
UseContentRootAsEnv
()
.
UseStartup
<
Startup
>();
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
=>
Host
.
CreateDefaultBuilder
(
args
)
.
ConfigureWindowsServices
()
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
webBuilder
.
ConfigureKestrel
(
serverOptions
=>
{
serverOptions
.
AllowSynchronousIO
=
true
;
});
webBuilder
.
UseStartup
<
Startup
>();
})
.
ConfigureQuartzHost
()
.
ConfigureServices
(
services
=>
{
services
.
AddHostedService
<
ModBusService
>();
});
}
}
\ No newline at end of file
IoTSharp.Edge.ModBus/Startup.cs
浏览文件 @
345e4eb0
using
IoT.Things.ModBus.Jobs
;
using
CrystalQuartz.AspNetCore
;
using
IoT.Things.ModBus.Jobs
;
using
IoT.Things.ModBus.Services
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Quartz
;
using
QuartzHostedService
;
using
Quartzmin
;
using
System
;
using
System.Linq
;
using
System.Reflection
;
...
...
@@ -28,8 +29,7 @@ namespace IoT.Things.ModBus
// This method gets called by the runtime. Use this method to add services to the container.
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddQuartzmin
();
services
.
AddMvc
().
SetCompatibilityVersion
(
CompatibilityVersion
.
Version_2_2
);
services
.
AddControllersWithViews
();
services
.
AddOptions
();
services
.
Configure
<
AppSettings
>(
Configuration
);
...
...
@@ -39,7 +39,7 @@ namespace IoT.Things.ModBus
});
services
.
AddQuartzHostedService
();
services
.
AddTransient
<
Slaver
>();
services
.
AddHostedService
<
ModBusService
>();
services
.
AddSingleton
(
options
=>
{
var
mqtt
=
new
IoTSharp
.
EdgeSdk
.
MQTT
.
MQTTClient
();
...
...
@@ -49,20 +49,22 @@ namespace IoT.Things.ModBus
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
I
Hosting
Environment
env
,
IOptions
<
AppSettings
>
options
,
ISchedulerFactory
factory
)
public
void
Configure
(
IApplicationBuilder
app
,
I
WebHost
Environment
env
,
IOptions
<
AppSettings
>
options
,
ISchedulerFactory
factory
)
{
if
(
env
.
IsDevelopment
())
{
app
.
UseDeveloperExceptionPage
();
}
app
.
UseQuartzmin
(
new
QuartzminOptions
()
app
.
UseRouting
();
app
.
UseEndpoints
(
endpoints
=>
{
Scheduler
=
factory
.
GetScheduler
().
Result
,
ProductName
=
typeof
(
Startup
).
Assembly
.
GetName
().
Name
,
endpoints
.
MapControllers
();
});
app
.
UseMvc
();
app
.
UseCrystalQuartz
(()
=>
factory
.
GetScheduler
().
Result
);
}
}
}
\ No newline at end of file
IoTSharp.Edge.ModBus/reame.md
浏览文件 @
345e4eb0
...
...
@@ -4,4 +4,7 @@
相关文章请参考
https://www.cnblogs.com/MysticBoy/p/11110364.html
\ No newline at end of file
https://www.cnblogs.com/MysticBoy/p/11110364.html
由于使用到的HSL组件已经闭源,本项目后期会从本项目中删除
\ No newline at end of file
IoTSharp.Edges.sln
浏览文件 @
345e4eb0
...
...
@@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D5C97089-F896-436D-8E99-27B2E43BC65F}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
GitVersion.yml = GitVersion.yml
LICENSE = LICENSE
README.md = README.md
roadmap.md = roadmap.md
...
...
@@ -23,6 +24,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Edge.ModBus", "IoT
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Extensions", "IoTSharp.Extensions\IoTSharp.Extensions.csproj", "{551E62E3-51DA-4C1D-8DBB-7346A29EE817}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Extensions.AspNetCore", "IoTSharp.Extensions.AspNetCore\IoTSharp.Extensions.AspNetCore.csproj", "{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -163,6 +166,26 @@ Global
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x64.Build.0 = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x86.ActiveCfg = Release|Any CPU
{551E62E3-51DA-4C1D-8DBB-7346A29EE817}.Release|x86.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|ARM64.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x64.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x64.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x86.ActiveCfg = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Debug|x86.Build.0 = Debug|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|Any CPU.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM64.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|ARM64.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x64.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x64.Build.0 = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x86.ActiveCfg = Release|Any CPU
{AC80DA58-F40E-4B3C-8271-A25F65FEB0CB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录