我们有一个在IIS 7.5上托管的网站。它只能通过https绑定访问。该应用程序具有从javascript调用的svc服务。 最近我们搬到了IIS 10,并且访问svc已经破了。
我试图修改web.config,但不确定我要改变什么。 这是服务的web.config部分:
`<system.webServer>
<modules>
<add name="AuthorizationModule" type="AuthorizationModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="APPortal.axd" verb="GET,POST" name="PdfHttpHandler" type="APPortalUI.Web.HttpHandler.PdfHttpHandler" />
<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.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<!--<add name=".svc" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" />
-->
<add name="svc-integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler" resourceType="File" requireAccess="Script" preCondition="integratedMode" />
</handlers>
...
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="157286400" />
<verbs>
<add verb="PUT" allowed="true" />
<add verb="DELETE" allowed="true" />
</verbs>
</requestFiltering>
</security>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
</files>
</defaultDocument>
<staticContent>
<mimeMap fileExtension=".svc" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="GRADS.MenuItemServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
...
<serviceBehaviors>
<behavior name="metadataAndDebug">
<serviceMetadata httpGetEnabled="true" httpGetUrl="" />
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"
/>
<services>
<service name="GRADS.MenuItemService">
<endpoint address="" behaviorConfiguration="GRADS.MenuItemServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webHttpDefaultBinding" contract="GRADS.MenuItemService" />
</service>
...
</services>
<bindings>
<webHttpBinding>
<binding name="webHttpDefaultBinding" maxReceivedMessageSize="8388608" maxBufferSize="8388608" maxBufferPoolSize="8388608">
<readerQuotas maxArrayLength="8388608" maxBytesPerRead="8388608" maxNameTableCharCount="8388608" maxStringContentLength="8388608" />
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
...
`
此配置在IIS 7.5中运行良好,但是当我尝试在IIS 10中访问服务时,会引发以下错误:
找不到与绑定WebHttpBinding的端点的scheme http匹配的基址。注册的基地址方案是[https]。
还有: 服务&#39; /services/xxxxService.svc'由于编译期间的异常,无法激活。异常消息是:找不到与绑定WebHttpBinding的端点的scheme http匹配的基址。注册的基地址方案是[https] ..] System.Runtime.AsyncResult.End(IAsyncResult result)+607194 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)+231 System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)+33 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+798 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+91
服务在vb.net中创建为svc文件: 例如:
<ServiceContract(Namespace:="")> _
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single, ConcurrencyMode:=ConcurrencyMode.Multiple)> _
Public Class xxxxService
<OperationContract()> _
<Web.WebGet()> _
Public Function Foo() As String
end function
end class
有人可以指出如何或在何处修复它? 我认为从IIS7迁移到IIS10应该不会那么痛苦。
感谢