我以前分别使用过每种标题技术。结合它们已经成为问题。
Web App可以在具有IIS Express(Visual Studio 2019)的Dev计算机上完美运行。
当我发布时,没有SignalR。如果我尝试导航到webaddress.com/signalr/hubs,则会收到404错误。
第一项修复:<modules runAllManagedmodulesForAllRequests="true">
- 此“修复”信号器。但是页面上没有引导程序,并且
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
用来修复没有Default.aspx的URL也会被破坏。
所以我猜想我必须使用一个“模块”来使Signalr再次工作,而“运行所有托管模块”太通用了?
这是我的Web配置。有任何想法吗?
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup,System,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089">
<section name="XXXXXXXXX.Properties.Settings" type="System.Configuration.ClientSettingsSection,PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="XXXXXXXXXX" connectionString="Data Source=XXXXXXX\SQLEXPRESS;Initial Catalog=XXXXXXX;Integrated Security=false;user=XXXXXXX;password=XXXXXXX" />
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<compilation targetFramework="4.6" debug="true" />
<httpruntime targetFramework="4.6" />
<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPNetaUTH" protection="None" path="/" defaultUrl="default.aspx" timeout="30" />
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="signalr">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Patient.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="aboutus.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="contact.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="iforgot.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="test.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="api/XXXX">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,microsoft.CodeDom.Providers.DotNetCompilerPlatform,Version=2.0.1.0,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,PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<applicationSettings>
<XXXXXXX.Properties.Settings>
<setting name="UserID" serializeAs="String">
<value>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</value>
</setting>
<setting name="FromEmail" serializeAs="String">
<value>XXXXXXX@xxxxxxxxxxxxxxxxxxxxxxx.com</value>
</setting>
<setting name="Emailusername" serializeAs="String">
<value>xxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxx</value>
</setting>
<setting name="EmailPassword" serializeAs="String">
<value>XXXXXXXXXX</value>
</setting>
<setting name="EmailServer" serializeAs="String">
<value>mail.XXXXXXXXXXXXXXXXXXX.com</value>
</setting>
<setting name="Token" serializeAs="String">
<value>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</value>
</setting>
</XXXXXXX.Properties.Settings>
</applicationSettings>
<system.webServer>
<modules >
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="system.web.Routing.UrlRoutingModule" preCondition="" />
<!-- any other modules you want to run in MVC e.g. FormsAuthentication,Roles etc. -->
</modules>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
</handlers>
<rewrite>
<rules>
<rule name="HTTPS force" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>