小编ala*_*irs的帖子

What are User Claims in IdentityServer4 API Resources vs. API Scopes

I've configured an instance of IdentityServer4 and have successfully configured it as a client for an OIDC provider. I'm now trying to set it up as the OIDC provider for my application. I've followed through the quickstarts and read the documentation, but I'm struggling to find an answer to my specific question.

User claims can be specified in a couple of different places: on the API resource and on the API scopes. What is the difference between specifying a user …

oauth-2.0 openid-connect identityserver4

9
推荐指数
2
解决办法
3547
查看次数

如何从网络共享调试Visual Studio 2010中的解决方案?

我最近买了一台新的Mac笔记本电脑,并在Parallels虚拟机中运行VS2010.它对我来说效果很好,但是我在调​​试特定项目类型时遇到了一些问题,这些问题与通过网络共享访问项目有关.测试项目无法运行,因为测试运行器无法加载测试的DLL.Web项目无法在Visual Studio迷你Web服务器中运行,引发以下异常:

'An error occurred loading a configuration file: Failed to start monitoring changes to path\to\web.config'.

我花了整整一夜的时间在网上搜索,但运气不好.在阅读了 两篇文章之后,我尝试了通常的CasPol更改,但随后发现了早期VS2010测试版中的一篇文章,表明在.NET 4.0和VS2010中不再需要/支持CasPol.

可以通过映射驱动器和UNC路径访问网络共享.UNC路径的主持人是.pfs; 根据这篇文章, Windows会将以点开头的主机名视为源自Internet区域.

虚拟机在管理员帐户下运行其应用程序,该帐户似乎具有网络共享上的所有必要权限,以创建,读取,写入和删除文件和文件夹.我说"似乎有",因为我无法通过资源管理器查看相应文件夹的安全属性:安全选项卡不存在.

有没有人设法成功加载和调试VS2010中网络共享的Web和测试项目?

更新: 我尝试使用我的MacBook的IP地址在单独的本机Windows计算机上加载VS2010中的解决方案,结果不尽相同.测试项目再次无法运行错误:

Error loading \\192.168.0.4\alastair\Code\project\bin\Debug\Tests.dll: Could not load file or assembly 'file://\\192.168.0.4\alastair\Code\project\bin\Debug\Tests.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

但是,ASP.NET MVC项目在此设置中按预期正确运行,如果我使用MacBook的NETBIOS名称,我会得到完全相同的结果.

当然,为了做到这一点,我必须在Snow Leopard中启用SMB共享,​​这不需要访问我的Parallels VM中的位置.也许在Parallels中有一些设置我需要调整以更改共享的权限?

我还为主持人标记了这个问题,要求将其移至StackOverflow; 我认为它可能比SuperUser更合适.

windows parallels visual-studio-2010

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

如何有条件地仅设置ComboBox所选项目中的文本样式?

我有一种情况,我需要以不同的方式对ComboBox中的所选项进行样式设置(使文本变为粗体),除非是一个值.例如,在标有"您最喜欢的原色是什么?"的下拉框中.我想有四个选项:No Preference,Red,Green,和Blue.ComboBox项只是具有默认样式的文本,没有图像或其他任何花哨的东西,而且是C#类,不包含在ComboBoxItems中.

当用户从列表中指定首选项时,我想通过将折叠列表中所选项目的文本设置为粗体来突出显示该选项.如果用户选择No Preference,字体粗细应该保持正常.

通过将ComboBox上的FontWeight属性设置为Bold,并将DataTrigger定义为,我已经实现了90%的解决方案SelectedItem != No Preference.但是,这会对ComboBox项目列表中的所有项目进行样式设置,包括下拉列表中的所有项目.我希望这些项目始终以正常的字体粗细显示.

这可能吗?

编辑

我一直在尝试@ crazyarabian用MultiTrigger设置ComboBoxItem样式的方法.样式定义是:

<Style x:Key="SelectedItemStyle">
    <Setter Property="ComboBoxItem.FontWeight" Value="Normal" />
    <Style.Triggers>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="ComboBoxItem.IsSelected" Value="True" />
                <Condition Binding="{Binding IsNoPreferenceSelected,Mode=OneWay}" Value="False" />
            </MultiTrigger.Conditions>
            <Setter Property="ComboBoxItem.FontWeight" Value="Bold" />
        </MultiTrigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

它应用于以下DataTemplate中的ComboBox:

<DataTemplate x:Key="PrimaryColoursTemplate" DataType="{x:Type ViewModels:PrimaryColoursViewModel}">
    <ComboBox ItemsSource="{Binding PrimaryColours}" SelectedItem="{Binding SelectedPrimaryColour}"
              ItemContainerStyle="{StaticResource SelectedItemStyle}" />
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)

不幸的是,这会杀死WPF:

System.Windows.Data Error: 8 : Cannot save value from target back to …
Run Code Online (Sandbox Code Playgroud)

wpf

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

用traefik重写内容URL

我们正在使用traefik来反向代理我们的微服务环境,该服务在Kubernetes上以登台和生产方式运行,并在本地docker-compose。我们正在尝试将对特定URL的请求代理到特定的微服务,以便,例如,“订单”微服务为我们系统中关注的API和UI提供服务。我们的目标让我们的服务是不可知的上他们的服务的话,例如URL中,“订单”微服务提供上/,而是从traefik请求代理http://api.me.com/orders/{id}具有PathPrefixStriporders于如http://orders.svc.kubernetes.local/{id}。我正在尝试解决一个问题,该服务需要知道服务在哪个URL上,以便它写出的URL包含中指定的值PathPrefix,但我不想重复关于PathPrefixtraefik和应用程序。在这种情况下,这是“必须要做的”事情吗,traefik能够重写响应中的URL,还是可以/应该应用其他某种技术来实现此目的?

注意:我已经阅读了 三个 类似的问题,但没有找到答案。

traefik

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

如何在一个应用程序中支持.NET 2.0和.NET 4.0?

这是一个有趣的.我有一个针对.NET 2.0构建的小型可执行文件,以确保它在各种平台上运行.它是一个汇编程序,它只引用System.*命名空间.

当我在安装了.NET 2.0的操作系统上运行它时,运行正常.它将操作系统上不能运行 .NET 4.0安装,因为与.NET 4.0中引入的新运行时.因此,我增加了支持的运行信息,以app.config文件,描述在这里.我添加了两个支持的运行时:

<supportedRuntime version="2.0.50727" />
<supportedRuntime version="4.0" />
Run Code Online (Sandbox Code Playgroud)

现在,当我在安装了.NET 2.0的系统上运行应用程序时,它无法运行:

在此输入图像描述

除了错误消息中请求的版本的顺序更改以反映对app.config的更改(因此CLR显然正确地获取该信息)之外,定义支持的运行时的顺序没有区别.我安装了.NET 2.0,它声称我需要安装.NET 2.0!我试过修复.NET 2.0的安装没有运气.我在第二台机器上重现了这种行为.

什么可能导致这失败?

.net clr

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

如何将InputObject上的NoteProperties访问到远程会话

我在PSObject使用定义的NoteProperties 访问s时遇到了困难,这些会被传递到远程会话Invoke-Command.我为此目的构造一个对象的原因是我需要在远程会话中访问两个单独的信息,但PowerShell只提供一个InputObject.

我的代码看起来像这样:

$sessionInput = new-object -TypeName System.Object
$sessionInput | Add-Member -MemberType NoteProperty -Name NoteProperty1 -Value @("some", "value")
$sessionInput | Add-Member -MemberType NoteProperty -Name NoteProperty2 -Value @("some", "other", "value)
$session = New-PSSession -ComputerName my-computer -Credential (Get-Credential)
Invoke-Command -Session $session -InputObject $sessionInput {
    $input #1
    $input | Get-Member #2
    $input.NoteProperty1 #3
    $input.NoteProperty1 | Get-Member #4
}
Run Code Online (Sandbox Code Playgroud)

我为上面的每个编号行得到以下输出.

1. $input

所以,首先我尝试了将变量转储到控制台的常用技术,确认属性是以预期值传递的:

NoteProperty1      : {some, value}
NoteProperty2      : {some, other, value}
PSComputerName     : my-computer
RunspaceId         : d1f35c8b-f631-4caa-bae0-f7c0066bbd55 …
Run Code Online (Sandbox Code Playgroud)

powershell powershell-2.0 powershell-remoting

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

设置和*.config有什么区别?

我过去曾使用*.config文件做过一些工作,但我根本没有使用设置文件.简单地说,项目的设置文件和*.config文件之间有什么区别?是否有关于哪些信息的约定?应该何时使用另一个?如何构建设置文件 - 它们是嵌入到程序集中还是保存在外部,如*.config文件?

.net configuration

4
推荐指数
1
解决办法
964
查看次数

如何在WiX权限元素中指定AppPool标识?

我正在更新我们的.NET 4.0和IIS 7.5安装程序之一,其中一项任务是将AppPool切换为使用自己的标识.我在使用IIS扩展的WiX中发现这相当微不足道,但是我正在努力处理我们定义的两组额外权限,特别是授予AppPool标识的写权限:

<Directory Id="LOGS_LOCATION" Name="logs">
    <!-- SourceDir\logs -->
    <Component Id="LogsFolder" Guid="{3A7C38C7-6604-4063-A425-D62427B21AEE}" KeyPath="yes" DiskId="1">
        <CreateFolder>
            <!-- SYSTEM account is automatically given access, but set other ACEs here to avoid Users having access -->
            <Permission User="Administrators" GenericAll="yes"/>
            <Permission User="[ASPNET_USER]" Domain="[ASPNET_DOMAIN]" GenericRead="yes" GenericWrite="yes" Read="yes" Delete="yes" DeleteChild="yes" Traverse="yes"/>
            <!-- IIS5: ASPNET, IIS6: NetworkService, IIS7: AppPool identity -->
        </CreateFolder>
    </Component>
</Directory>
Run Code Online (Sandbox Code Playgroud)

ASPNET_USER并且ASPNET_DOMAIN被定义为AppPoolNameIIS APPPOOL(分别AppPoolName与应用程序池的名称完全匹配).

当我运行安装程序时,我收到1609错误,指出它IIS APPOOL\AppPoolName不是有效身份,安装失败.如何将"应用程序池标识"指定给"权限"元素,以便Web应用程序可以写入日志目录?我需要使用不同的身份吗?

iis windows-installer wix iis-7.5 wix3.5

3
推荐指数
1
解决办法
3317
查看次数

为什么XDocument.Descendants()在PowerShell ISE中返回IEnumerator?

我正在编写一个PowerShell脚本来操作一些Windows Installer XML(WiX).我正在使用.NET 3.5中的新XML API来实现这一点,因为我发现它比DOM更容易使用API​​.以下脚本片段断然拒绝工作:

[System.Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq") | Out-Null

# Basic idea: Iterate through en.wxl's l10ns, get string for each l10n, search all wxs files for that value.

pushd "C:\temp\installer_l10n"
$wxlFileName = "${pwd}\en.wxl"
$wxl = [System.Xml.Linq.XDocument]::Load($wxlFileName)
$strings = $wxl.Descendants("String")
$strings
$strings | foreach {
    $_
}
popd
Run Code Online (Sandbox Code Playgroud)

该脚本在单独的行上输出每个<String>标记.一旦这个bug得到解决,我就会让它做一些更有趣的事情;-)

XML文档是标准的WiX本地化文件:

<?xml version="1.0" encoding="utf-8" ?>
<WixLocalization Culture="en-US" xmlns="http://schemas.microsoft.com/wix/2006/localization">
   <String Id="0">Advertising published resource</String>
   <String Id="1">Allocating registry space</String>
   ...
</WixLocalization>
Run Code Online (Sandbox Code Playgroud)

$ strings不是$ null(我已经明确地测试了它),如果我写了host-wxl,我可以看到文件已被加载.将$字符串管理到Get-Member会返回一个错误,指出"没有为get-member指定任何对象",write-host $字符串不执行任何操作.我也尝试过$ wxl.Descendants("WixLocalization"),结果相同.像$ wxl.Root和$ wxl.Nodes这样的东西按预期工作.使用PowerShell ISE进行调试,我看到$ strings已设置为IEnumerator,而不是预期的IEnumerable <XElement>.使用单个MoveNext测试IEnumerator,然后使用Current测试"Current =",大概是$ null.

奇怪的是,相同的技术在以前的脚本中起作用.完全相同的代码,但具有不同的变量名和字符串文字.刚刚尝试调试该脚本(以验证行为),它似乎现在也显示相同的行为.

xml powershell linq-to-xml powershell-ise powershell-2.0

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

ASP.NET MVC:如何在除一个视图之外的所有视图上呈现局部视图?

我有一个名为LogOnUserControl的部分视图/用户控件,它显示在我站点的侧栏中(在Site.Master中定义).我还有一个单独的LogOn视图,它也呈现LogOnUserControl.

我不希望在LogOn视图中有两个LogOnUserControl实例,因为它只是简单的混乱,所以我目前的想法是包括一个条件,如

// Semi-pseudocode
if (!Request.IsAuthenticated) && View.Name != "LogOn")
Run Code Online (Sandbox Code Playgroud)

在LogOnUserControl中.

这感觉不对,因为局部视图现在知道LogOn视图.此外,我无法找到如何获取View的名称,这加强了我做错事的感觉!:-)

编辑: 进一步的复杂性是,相同的局部视图用于Site.Master中的LogOn视图和侧边栏.

asp.net-mvc partial-views

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

NHibernate为什么要进行UPDATE而不是INSERT?

继续我在我的播客应用程序中对NHibernate的探索,我遇到了一些奇怪的事情:当我期望INSERT时,NHibernate正在更新.情况是播客与其项目之间的简单的一对多关系.这是我的NHibernate映射:

<hibernate-mapping assembly="App.DataModel">
  <class name="Feed" table="Feeds">
    <!-- snip -->
    <bag name="FeedItems" table="FeedItems" cascade="all">
      <key column="FeedId" />
      <one-to-many class="FeedItem" />
    </bag>
  </class>
</hibernate-mapping>
Run Code Online (Sandbox Code Playgroud)

情况是:我创建了一个新Podcast对象,从feed更新它(所以Podcast.FeedItems集合属性包含许多FeedItems),现在我将它保存到数据库中ISession.Save().根据NHibernate日志文件判断,该Podcast对象已正确插入数据库,但该FeedItems集合正在UPDATEd中.这是为以下内容生成的SQL Podcast:

INSERT INTO Feeds (
    Uri, IsPublic, Title, Description, Link, Language, Copyright, 
    LastBuildDate, PublishDate, Docs, Webmaster, Author, Subtitle, 
    Summary, OwnerName, OwnerEmail, IsExplicit, ImageUri, Id 
) VALUES (
    @p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, 
    @p12, @p13, @p14, @p15, @p16, …
Run Code Online (Sandbox Code Playgroud)

nhibernate nhibernate-mapping

0
推荐指数
1
解决办法
1998
查看次数