小编Cod*_*kie的帖子

HTTP错误403.14 - 禁止的asp.net 5和MVC 6 iis10

我知道这个问题已被问过并回答了几次,但这些问题略有不同,这些问题的答案并没有解决我的问题.

我有一个asp.net 5和MVC 6应用程序,可以在IIS Express中正常工作并在WEB中自托管.但是,当我发布到一个文件夹并指向IIS的wwwroot文件夹时,我收到HTTP错误403.14 - 禁止错误.

我尝试过IISReset,但我确实有一个默认的root.

iis http-status-code-403 asp.net-core-mvc asp.net-core

11
推荐指数
1
解决办法
4339
查看次数

netcoreapp2.0与netstandard2.0

我有一个针对NetStandard.Library 2.0的项目(x)和一个针对netcoreapp2.0的控制台应用程序.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
    <PackageReference Include="NETStandard.Library" Version="2.0.0-beta-25021-01" />
    <PackageReference Update="Microsoft.NETCore.App" Version="2.0.0-beta-001588-00" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\x.csproj" />
  </ItemGroup>

</Project>
Run Code Online (Sandbox Code Playgroud)

X计划:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
  </ItemGroup>


  <ItemGroup>
    <PackageReference Update="NETStandard.Library" Version="2.0.0-beta-25017-01" />
  </ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

当我编译控制台应用程序时,我得到错误:

Project x与netcoreapp2.0(.NETCoreApp,Version = v2.0)/ …

c# .net-core .net-standard

11
推荐指数
1
解决办法
2万
查看次数

你如何阅读Windows 10核心的串口

在Raspberry PI上使用python我使用与下面显示的类似的代码来从串口读取数据:

baud = 9600                 # baud rate
port = '/dev/ttyACM0'       # serial URF port on this computer

ser = serial.Serial(port, baud)
ser.timeout = 0 
var message = ser.read(9);
Run Code Online (Sandbox Code Playgroud)

基本上我只是希望能够从串口读取消息并根据该消息执行操作.

如何使用Windows 10 Core和c#实现这一点,任何人都能指出正确的方向或提供代码示例吗?

提前感谢您收到的任何帮助.

c# core raspberry-pi win-universal-app windows-10

6
推荐指数
1
解决办法
2万
查看次数

Reflection.emit System.InvalidProgramException:公共语言运行时检测到无效程序

我是反射的新手.并且一直在尝试生成以下c#代码:

public class RepositoryWrapper
{
    public void CallRepositoryMethod(IAddressRepository repository, Address address)
    {
        repository.NODE_I_NodeExtendedDetails_Address3(address.NodeId);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是它的代表:

    IL_0000: nop
    IL_0001: ldarg.1
    IL_0002: ldarg.2
    IL_0003: callvirt instance int32 ReflectionServices.Node::get_NodeId()
    IL_0008: callvirt instance void ReflectionServices.IAddressRepository::NODE_I_NodeExtendedDetails_Address3(int32)
    IL_000d: nop
    IL_000e: ret
Run Code Online (Sandbox Code Playgroud)

这是我用来创建它的代码:

 internal static void Generate(this System.Reflection.Emit.ILGenerator @this, Type target,string method,Type instance)
        {

        var methodToCall = target.GetMethod(method);
        var methodParams = methodToCall.GetParameters();
        var instanceProperties = instance.GetProperties(BindingFlags.Public | BindingFlags.Instance);

        var orderedProperties = (from mp in methodParams
                              join p in instanceProperties
                              on mp.Name.ToLower() equals p.Name.ToLower()
                              select p).ToArray();

        //add …
Run Code Online (Sandbox Code Playgroud)

c# reflection.emit

5
推荐指数
1
解决办法
3162
查看次数