asp.net-mvc – 为什么我的ASP.NET MVC应用程序试图导航到login.
发布时间:2020-12-16 03:16:13 所属栏目:asp.Net 来源:网络整理
导读:我有一个非常简单的“Hello World”级应用程序,我在ASP.NET MVC 4 / Razor中构建.它在调试模式下工作正常.没有认证;它直接进入Home / Index. 现在我将它发布到IIS.但是当我通过IIS查看它时,由于某种原因它正在尝试加载“login.aspx”表单.我没有定义任何这样
我有一个非常简单的“Hello World”级应用程序,我在ASP.NET MVC 4 / Razor中构建.它在调试模式下工作正常.没有认证;它直接进入Home / Index.
现在我将它发布到IIS.但是当我通过IIS查看它时,由于某种原因它正在尝试加载“login.aspx”表单.我没有定义任何这样的表单,不是在web.config中,而是在系统中的任何其他地方.无论我在URL中放置什么路径,它总是会重定向到不存在的login.apsx. 为什么?我如何解决它? 编辑:根据评论者的要求,这是我的Web.config: <?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application,please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <configSections> <!-- For more information on Entity Framework configuration,visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=5.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection,DotNetOpenAuth.Core"> <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement,DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" /> <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement,DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" /> <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement,DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" /> <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement,DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" /> </sectionGroup> </configSections> <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=(LocalDb)v11.0;Initial Catalog=aspnet-AdminBackdoor-20130314103822;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnet-AdminBackdoor-20130314103822.mdf" providerName="System.Data.SqlClient" /> <add name="MyProjectEntities" connectionString="metadata=res://*/MyProjectEntities.csdl|res://*/MyProjectEntities.ssdl|res://*/MyProjectEntities.msl;provider=System.Data.SqlClient;provider connection string='data source=localhost;initial catalog=MyProject;Integrated Security=True; ;MultipleActiveResultSets=True;App=EntityFramework'" providerName="System.Data.EntityClient" /> </connectionStrings> <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="PreserveLoginUrl" value="true" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> <authentication mode="None"> <!--<forms loginUrl="~/Account/Login" timeout="2880" />--> </authentication> <pages> <namespaces> <add namespace="System.Web.Helpers" /> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Optimization" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> </namespaces> </pages> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <handlers> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFrameworkv4.0.30319aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFramework64v4.0.30319aspnet_isapi.dll" preCondition="classicMode,bitness64" responseBufferLimit="0" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly> </assemblyBinding> <legacyHMACWarning enabled="0" /> </runtime> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,EntityFramework" /> </entityFramework> <system.net> <defaultProxy enabled="true" /> <settings> <!-- This setting causes .NET to check certificate revocation lists (CRL) before trusting HTTPS certificates. But this setting tends to not be allowed in shared hosting environments. --> <!--<servicePointManager checkCertificateRevocationList="true"/>--> </settings> </system.net> <dotNetOpenAuth> <messaging> <untrustedWebRequest> <whitelistHosts> <!-- Uncomment to enable communication with localhost (should generally not activate in production!) --> <!--<add name="localhost" />--> </whitelistHosts> </untrustedWebRequest> </messaging> <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --> <reporting enabled="true" /> <openid> <relyingParty> <security requireSsl="false"> <!-- Uncomment the trustedProviders tag if your relying party should only accept positive assertions from a closed set of OpenID Providers. --> <!--<trustedProviders rejectAssertionsFromUntrustedProviders="true"> <add endpoint="https://www.google.com/accounts/o8/ud" /> </trustedProviders>--> </security> <behaviors> <!-- The following OPTIONAL behavior allows RPs to use SREG only,but be compatible with OPs that use Attribute Exchange (in various formats). --> <add type="DotNetOpenAuth.OpenId.RelyingParty.Behaviors.AXFetchAsSregTransform,DotNetOpenAuth.OpenId.RelyingParty" /> </behaviors> </relyingParty> </openid> </dotNetOpenAuth> <uri> <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),which is necessary for OpenID urls with unicode characters in the domain/host name. It is also required to put the Uri class into RFC 3986 escaping mode,which OpenID and OAuth require. --> <idn enabled="All" /> <iriParsing enabled="true" /> </uri> </configuration> 解决方法
如果其他人遇到此问题,还有其他可能的解决方案,如
this other SO question中所述.从bin目录中删除WebMatrix DLL.
如果您使用VS 2010中的“添加可部署依赖项”,则可能会出现此问题.这包括WebMatrix内容,这些内容会在某些情况下破坏您的身份验证.在这种情况下,从_bin_deployableAssemblies目录中删除WebMatrix,这将在构建或部署时将其保留在bin之外. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- [ASP NET MVC] 使用ReportViewer执行用户端报表定义文件(.r
- 在asp.net App_Code目录中使用Nemerle
- asp.net – 混合Windows / Forms身份验证跨站点
- asp.net-mvc – “Inject”Request.Url.Hosts – ASP.net M
- ASP.NET MVC - HTML 帮助器
- ASP.net缓存访问导致foreach循环中的Collection Modified异
- asp.net-core – asp.net核心身份中的多个&SubDomain的
- 使用ASP.NET/SQL Server丢失会话状态
- asp.net-core – 无法解析目标框架’DNX,Version = v4.5.1’
- .net – 使用新技术时的安全问题
推荐文章
站长推荐
- 实体框架 – 使用ASP.NET Web API和实体框架进行
- asp.net-mvc-4 – 为什么MVC4 @ Styles.Render()
- asp.net – 动态地将用户控件添加到转发器
- asp.net-mvc – 如何将锚/哈希的参数添加到Redir
- asp.net – 优化的捆绑包在从网站请求时返回404
- asp.net – 应用程序池循环如何影响ASP Net会话状
- asp.net-core – 为Microsoft.CodeAnalysis.Comm
- asp.net-mvc-4 – 如何开发一个ASP.NET Web API接
- 推荐最新的Asp.Net Core 下开源的AOP框架 Aspect
- asp.net-mvc-3 – 将以“.cshtml”结尾的请求路由
热点阅读