我正在尝试发布一项服务并让它使用 Windows 身份验证,当我什至尝试发布它时出现错误,所以我还没有得到足够的提示输入用户名。
这是我的错误:
[ArgumentException: ServiceHost only supports class service types.]
System.ServiceModel.Description.ServiceDescription.GetService(Type serviceType) +16602430
System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& implementedContracts) +80
System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +174
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: ServiceHost only supports class service types..]
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" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="log4net.Internal.Debug" value="true" />
</appSettings>
<system.web>
<compilation targetFramework="4.0" debug="true">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="DefaultCache" duration="60" varyByParam="none" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="None">
<!-- 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="None" />
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="default">
<security mode="None">
<!-- Basic <security mode="Transport"> -->
<!-- To use Basic auth, just comment Windows and use this -->
<!-- <transport clientCredentialType="Basic" /> -->
<transport clientCredentialType="None" />
</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 httpGetEnabled="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="true" />
</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="webHttpBinding" bindingConfiguration="default" behaviorConfiguration="restBehavior" contract="subservice.ISubService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<httpProtocol>
<customHeaders>
<add name="p3p" value="CP="CAO PSA OUR"" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
我的 web.release.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.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
这是我的应用程序的样子:
有人看到我做错了什么吗?