小编Wou*_*r B的帖子

打包SF无状态ASP.NET Core Web应用程序后代码丢失

我创建了一个Service Fabric应用程序,它具有普通的无状态服务和无状态的ASP.NET Core Web应用程序.在不更改任何默认代码的情况下,我尝试部署应用程序.部署期间发生错误:

Register-ServiceFabricApplicationType:
C:\ SfDevCluster\Data\ImageBuilderProxy\AppType\AadMockApplicationType中应用程序的BuildLayout无效.服务
TenantWebServerPkg 缺少代码.

在检查我的包之后,我注意到包中没有包含代码,只有服务清单文件和配置包:

在此输入图像描述

我的Web应用程序服务清单:

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="TenantWebServerPkg"
                 Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <!-- This is the name of your ServiceType. 
         This name must match the string used in RegisterServiceType call in Program.cs. -->
    <StatelessServiceType ServiceTypeName="TenantWebServerType" />
  </ServiceTypes>

  <!-- Code package is your service executable. -->
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>TenantWebServer.exe</Program>
        <WorkingFolder>CodePackage</WorkingFolder>
      </ExeHost>
    </EntryPoint>
  </CodePackage>

  <!-- Config package is the contents of the Config directoy under PackageRoot that contains an 
       independently-updateable …
Run Code Online (Sandbox Code Playgroud)

c# asp.net azure-service-fabric service-fabric-stateless

7
推荐指数
1
解决办法
719
查看次数

使用 Azure AD 身份验证进行自定义授权

我正在使用 ASP.NET Core 2.0 开发一个 Service Fabric 无状态 Web 应用程序。此应用程序使用 Azure AD 对多个 AD 租户的用户进行身份验证。我想要实现的是使用我自己的基于角色的授权,可以使用授权用户在我的应用程序中进行配置。这些角色存储在我的应用程序中。

在我当前的实现中,我通过使用我的自定义添加策略来向我的应用程序添加授权IAuthorizationRequirement。在需求授权期间,根据用户权限添加声明。这意味着声明是在登录后添加的。该[Authorize(Roles = "role")]属性也不起作用,因为角色声明是在登录后添加的

实现使用 Azure AD 中经过身份验证的用户的自定义授权的正确方法是什么?

asp.net authorization azure-active-directory azure-service-fabric asp.net-core-2.0

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