C# 允许任何用户访问';信号机/集线器';没有凭据,使用cors(服务器运行windows身份验证)
我有两台服务器C# 允许任何用户访问';信号机/集线器';没有凭据,使用cors(服务器运行windows身份验证),c#,web-config,cors,signalr,C#,Web Config,Cors,Signalr,我有两台服务器 信号器主机(windows身份验证,IIS) 网页主机的其余部分(表单身份验证、IIS) 我已经把它全部设置好了,它可以在Chrome中与longpolling一起工作。(1) 使用Firefox并导航到https://localhost:44301/signalr/hubs (1) 使用windows身份验证。我试图通过在web.config中执行以下操作来避免身份验证: <location path="signalr"> <system.web>
https://localhost:44301/signalr/hubs
(1) 使用windows身份验证。我试图通过在web.config
中执行以下操作来避免身份验证:
<location path="signalr">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
* ? (这包括所有信号员/协商呼叫+)尝试
<allow users="?"/>
由于它允许匿名,使用asterix“*”可以允许“所有用户”。我通过更改问题的前提解决了这个问题
现在,可以匿名访问整个服务器,但需要windows身份验证的路径已在其自身上指定
需要保护的控制器的外观示例如下:
<location path="#####.ashx">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false"/>
<windowsAuthentication enabled="true"/>
</authentication>
<authorization>
<remove users="?" roles="" verbs="" />
<add accessType="Deny" users="?" />
</authorization>
</security>
</system.webServer>
< /location>
我当然会认为“所有用户”也包括“匿名”用户。。。然而问题不是吗?或者*,这是因为“位置路径”不存在。标题上写着“删除作者”,我脑子里最快的事情就是允许匿名。@BjørnØyvindHalvorsen简言之,答案是我作为原始问题的答案写的:)很高兴你把它整理好了!最初的问题不仅仅是标题。。。最初的问题是问题的标题和主体。如果你读了这两本书,你就会知道这只是权限的变化,而不是限制因素?比*更具限制性,因此不会解决我的任何问题…@BjørnØyvindHalvorsen足够公平了。很高兴现在解决了:)!希望它在将来对某些人有用。
<location path="#####.ashx">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false"/>
<windowsAuthentication enabled="true"/>
</authentication>
<authorization>
<remove users="?" roles="" verbs="" />
<add accessType="Deny" users="?" />
</authorization>
</security>
</system.webServer>
< /location>
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true"/>
<windowsAuthentication enabled="true"/>
</authentication>
<authorization>
<add accessType="Allow" users="?" />
</authorization>
<requestFiltering>
<!--Auction searches with 250 results generates slightly longer string than standard setting of 2048-->
<requestLimits maxQueryString="3072" />
</requestFiltering>
</security>
</system.webServer>