wcf
서비스를 만들었지 만 실행하면 다음과 같은 오류가 표시됩니다.내 wcf 서비스를 실행할 수 없습니다.
이름 바꾸기 도구를 사용하여 이름 클래스와 인터페이스 이름을 변경했습니다.
[ServiceContract]
public interface MyServices
{
[OperationContract]
string MyTask1(string myValue);
[OperationContract]
string MyTask2(DataContract1 dcValue);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class DataContract1
{
string firstName;
string lastName;
[DataMember]
public string fname
{
get { return firstName; }
set { firstName = value; }
}
public string lname
{
get { return lastName; }
set { lastName = value; }
}
}
내 web.config 파일을 편집하고, (나는 검은 색으로 읽을이 라인을 추가했습니다 : 여기 는
여기public class MyTest : MyServices
{
public string MyTask1(string a)
{
return "Hello " + a;
}
public string MyTask2(DataContract1 dc)
{
return "Hello " + dc.fname;
}
}
내 인터페이스에 대한 코드입니다 service.cs 클래스에 대한 코드 책) 여기
<service name="Service" behaviorConfiguration="ServiceBehavior">
<!--Service EndPoints-->
<endpoint address="" binding="wsHttpBinding" contract="MyServices">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadatExchange"/>
</service>
내는 system.serviceModel 코드
<system.serviceModel>
<services>
<!-- My Custimization -->
<service name="Service" behaviorConfiguration="ServiceBehavior">
<!--Service EndPoints-->
<endpoint address="" binding="wsHttpBinding" contract="MyServices">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadatExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
나는이 라인을 이해하지 못한다. 어떤 목적으로 쓰여졌는지 –
메타 데이터 또는 서비스 설명을 얻기위한 바인딩이다. . 비활성화 된 경우 wsdl을 가져올 수 없습니다. –
'ServiceBehavior' 설정을 보여줄 수 있습니까? 아니면' 섹션 전체를 최상으로 만들 것인가? –
Szymon