昨日VSテストクライアントで正常に動作するように見えたWCFサービスを作成していますが、今日はweb.configファイルを変更しようとした後、このエラーがスローされているようです。
以下はコードと構成ファイルです。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace TSService
{
interface name "IService1" in both code and config file together.
[ServiceContract]
public interface ITSService
[OperationContract]
List<Sel_Test> RunScript(List<SName> SNamesToRun, int LogPathIndex, RunEnvironment EnvironmentName, BOptions BType, NavOption NavEnum);
}
[DataContract]
public class STest
{
[DataMember]
public ScriptName SName { get; set; }
[DataMember]
public BOptions BTypeUsed { get; set; }
[DataMember]
public int SResult { get; set; }
}
[DataContract(Name= "SName")]
public enum SName
{
[EnumMember]
PXXXX1,
[EnumMember]
PXXXX2,
[EnumMember]
PXXXX3,
[EnumMember]
PXXXX4
}
[DataContract]
public enum NavOption
{
[EnumMember]
ContinueToNext,
[EnumMember]
Skip,
[EnumMember]
SignIn,
[EnumMember]
Registration
}
[DataContract]
public enum BOptions
{
[EnumMember]
FAA1,
[EnumMember]
ReFi,
[EnumMember]
RIE
}
[DataContract]
public enum RunEnvironment
{
[EnumMember]
D,
[EnumMember]
Q,
[EnumMember]
S,
[EnumMember]
P
}
[DataContract]
public enum PType
{
[EnumMember]
MAPD,
[EnumMember]
PDP,
[EnumMember]
MA,
[EnumMember]
Mgap
};
}
構成ファイルには次のものがあります。
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="TSServiceBehavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" 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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TSService.ITSService" behaviorConfiguration="TSServiceBehavior">
<endpoint address=""
binding ="basicHttpBinding"
contract="TSService.ITSService" />
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name ="TSServiceBinding" receiveTimeout="00:20:00" sendTimeout="00:20:00">
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<!--<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>-->
<serviceHostingEnvironment aspNetCompatibilityEnabled="False" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
SVCマークアップで私は持っています:
<%@ ServiceHost Language="C#" Debug="true" Service="TSService.ITSService" CodeBehind="TSService.svc.cs" %>
VS WCFTest クライアントの実行中に発生するエラー:
Error: Cannot obtain Metadata from http://localhost:55178/TSService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:55178/TSService.svc Metadata contains a reference that cannot be resolved: 'http://localhost:55178/TSService.svc'. The requested service, 'http://localhost:55178/TSService.svc' could not be activated. See the server's diagnostic trace logs for more information.HTTP GET Error URI: http://localhost:55178/TSService.svc There was an error downloading 'http://localhost:55178/TSService.svc'. The request failed with the error message:--
Server Error in '/' Application.
--------------------------------------------------------------------------------
ServiceHost only supports class service types.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: ServiceHost only supports class service types.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: ServiceHost only supports class service types.] System.ServiceModel.Description.ServiceDescription.GetService(Type serviceType) +12912843 System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& implementedContracts) +58 System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +146 System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) +46 System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +146 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +30 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +494 System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1434 System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598[ServiceActivationException: The service '/TSService.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) +495736 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178 System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +348782 System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9662977
--------------------------------------------------------------------------------
Version Information:ÿMicrosoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034 --.