Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何让IIS不拒绝登录?返回URL=%2F?_C#_Asp.net_Xml_Iis - Fatal编程技术网

C# 如何让IIS不拒绝登录?返回URL=%2F?

C# 如何让IIS不拒绝登录?返回URL=%2F?,c#,asp.net,xml,iis,C#,Asp.net,Xml,Iis,嗯,我已经在ASP.NET MVC5中完成了我的项目,我正在尝试将我的web应用安装到本地服务器IIS。我使用ASP身份管理登录,但当安装在IIS中时,chrome显示“连接错误”。我在IIS服务器中完成了一些基本配置和权限,并禁用了登录返回链接,web应用程序在IIS中按预期工作,但出于安全原因,我需要具有登录名的应用程序。这是我的配置: 身份验证: 文件夹权限: Web.config <appSettings> <add key="webpages:Ve

嗯,我已经在ASP.NET MVC5中完成了我的项目,我正在尝试将我的web应用安装到本地服务器IIS。我使用ASP身份管理登录,但当安装在IIS中时,chrome显示“连接错误”。我在IIS服务器中完成了一些基本配置和权限,并禁用了登录返回链接,web应用程序在IIS中按预期工作,但出于安全原因,我需要具有登录名的应用程序。这是我的配置:

身份验证:

文件夹权限:

Web.config

    <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="owin:AutomaticAppStartup" value="true" />
    <!--<add key="autoFormsAuthentication" value="false"/>
    <add key="enableSimpleMembership" value="false"/>-->
  </appSettings>



  <system.web>

    <!--<authentication mode="Windows" />
    <authorization>
      <allow users="?" />
    </authorization>-->

    <compilation debug="true" targetFramework="4.7.2" />
    <httpRuntime targetFramework="4.7.2" />
    <customErrors mode="Off" defaultRedirect="~/Views/Shared/InternalError.cshtml" />
  </system.web>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>


  <!--ORIGINAL-->
  <connectionStrings>
    <add name="Context"
         connectionString="Server=servername\SQLEXPRESS;Initial Catalog=testingroles;Trusted_Connection=True;"
         providerName="System.Data.SqlClient"/>
  </connectionStrings>

  <entityFramework>
    <contexts>
      <context type="HotelRestTikalShared.Data.Context, HotelRestTikalShared">
        <databaseInitializer type="HotelRestTikalShared.Data.DatabaseInitializer, HotelRestTikalShared" />
      </context>
    </contexts>

    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>



</configuration>

以前也有同样的问题。您不能使用端口80在
Http
请求上运行重定向链接。更改端口号并设置为
Https

转到操作>绑定

单击“添加”,将类型更改为https,设置要使用的任何端口,并将SSL证书设置为“IIS Express开发证书”


现在尝试使用该新端口运行web应用。

Azure应用程序服务通常会自动为您配置有效绑定及其相应的网络/防火墙,但对于您自己的本地IIS服务器,您有责任,您认为这是与防火墙相关的问题吗?或者我必须在IIS中配置更多内容?尝试检查日志是否有任何有用的信息可用。还要检查输入的URL和iis绑定详细信息是否正确。也请参考此链接,以了解我更改的端口,并使用https而不是http,它工作正常。