我正在尝试在iis服务器上发布wcf Web服务并让它使用Windows身份验证。我甚至在尝试发布它时遇到错误,所以我没有得到足够的提示输入用户名。我有SSL证书,想要使用ssl。
这是我的错误:
[InvalidOperationException: Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https].]
System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) +16604769
System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) +1082
System.ServiceModel.ServiceHostBase.ApplyConfiguration() +156
System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +215
System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +475
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +43
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +530
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1413
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +50
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1172
[ServiceActivationException: The service '/subservice/ISubService.svc' cannot be activated due to an exception during compilation. The exception message is: Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https]..]
System.Runtime.AsyncResult.End(IAsyncResult result) +901424
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178638
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136
我已经研究了这一百次,但我对发布服务的经验很少。一旦他们建成,我就和他们一起工作,从来没有发表过。
这是我从另一个web.config修改的web.config,其中发布的内容很好:
<?xml version="1.0"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="Transport">
<!-- Basic <security mode="Transport"> -->
<!-- To use Basic auth, just comment Windows and use this, but you need to configure basic in IIS as well -->
<!-- <transport clientCredentialType="Basic" /> -->
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="default">
<security mode="Transport">
<!-- Basic <security mode="Transport"> -->
<!-- To use Basic auth, just comment Windows and use this -->
<!-- <transport clientCredentialType="Basic" /> -->
<transport clientCredentialType="Windows" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="subservice.ISubService">
<endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding" contract="subservice.ISubService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="rest" binding="webHttpsBinding" bindingConfiguration="default" behaviorConfiguration="restBehavior" contract="subservice.ISubService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress = "https://[site]/subservice/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
任何人都能看到我做错了什么?
答案 0 :(得分:2)
使用basicHttpsBinding
而不是使用basicHttpBindinghttp://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpsbinding.aspx