首页 > 解决方案 > 无法停止 IIS Express 要求在我的本地 Silverlight 应用程序上对我进行身份验证

问题描述

编辑: 我不需要任何关于 Silverlight 几乎过时的傲慢回复。我当然知道这一点。当您为一家公司从事软件支持工作时(a)您无法使用时间机器来更改多年前做出的选择,并且(b)您通常必须支持不是最新的系统,因为“只需更换它”不一定是可能的。是的,这个系统正在被淘汰。如果纯粹是 Silverlight 对从 WebDev 到 IIS Express 的更改做出反应,那么请引用对该效果的引用。

我的笔记本电脑似乎有一个同事没有遇到的非常具体的问题。当我在本地运行最新版本的 Silverlight UI 解决方案时,我总是被要求登录。但是,我的用户凭据(与我用来登录笔记本电脑的凭据相同)总是被拒绝。

不同之处在于,在最新的解决方案中,我们现在调用的是 IIS Express。

以前的解决方案是这样运行的(通过启动批处理文件 - 我不清楚解决方案中发生了什么变化),如果我返回使用此表单,我可以避免身份验证

start webdev.webserver40.exe /port:{port number} /path:"%CD%\{application folder}"

而对于 IIS Express,我们使用的是:

start iisexpress.exe /config:"%CD%\{solution folder}\.vs\config\applicationhost.config" /site:{site name as shown in applicationhost.config}

我查看了 applicationhost.config 文件:

我最后改变了这个

<location path="{site path}">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="true" />
                <windowsAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>

安全块看起来不错:

           <access sslFlags="None" />
           <applicationDependencies>
                <application name="Active Server Pages" groupId="ASP" />
            </applicationDependencies>
           <authentication>
               <anonymousAuthentication enabled="true" userName="" />
               <basicAuthentication enabled="false" />
               <clientCertificateMappingAuthentication enabled="false" />
               <digestAuthentication enabled="false" />
               <iisClientCertificateMappingAuthentication enabled="false">
                </iisClientCertificateMappingAuthentication>
               <windowsAuthentication enabled="false">
                    <providers>
                        <add value="Negotiate" />
                        <add value="NTLM" />
                    </providers>
                </windowsAuthentication>
           </authentication>
           <authorization>
                <add accessType="Allow" users="*" />
            </authorization>
           <ipSecurity allowUnlisted="true" />

对我未经训练的眼睛。

最后我什至更新了 csproj.user 文件

  <PropertyGroup>
    <UseIISExpress>true</UseIISExpress>
    <IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
    <IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>
    <IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
  </PropertyGroup>

使用 IIS Express 是错误的,并且启用了 Windows 并禁用了匿名。

但这些设置在旧代码中也是如此。

我真的很困惑可以在我的机器上设置什么。

注意:Windows 10、VS 2015。

标签: c#visual-studioauthenticationsilverlightiis-express

解决方案


推荐阅读