2014-01-23 2 views
1

나는 wcf를 배우고있다. 그래서 난 그냥 어디에 간단하게 쓰기 TCP 바인딩을 사용 & basicHttpBinding. basicHttpBinding으로 서비스 만 실행하면 문제가 발생하지 않지만 tcp 바인딩을 걸면 문제가 발생합니다. 그래서 여기에 내 코드와 스크린 샷을 붙이고 있습니다. 내 솔루션 화면이 enter image description hereWCF 서비스 및 TCP 바인딩 문제

여기에 설정 항목 상세 정보

namespace WcfServiceLibrary4 
{ 
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together. 
    [ServiceContract] 
    public interface IService1 
    { 

     [OperationContract] 
     string GetData(int value); 

     [OperationContract] 
     CompositeType GetDataUsingDataContract(CompositeType composite); 

     // TODO: Add your service operations here 
    } 


    // Use a data contract as illustrated in the sample below to add composite types to service operations. 
    [DataContract] 
    public class CompositeType 
    { 
     bool boolValue = true; 
     string stringValue = "Hello "; 

     [DataMember] 
     public bool BoolValue 
     { 
      get { return boolValue; } 
      set { boolValue = value; } 
     } 

     [DataMember] 
     public string StringValue 
     { 
      get { return stringValue; } 
      set { stringValue = value; } 
     } 
    } 
} 

namespace WcfServiceLibrary4 
{ 
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together. 
    public class Service1 : IService1 
    { 
     public string GetData(int value) 
     { 
      return string.Format("You entered: {0}", value); 
     } 

     public CompositeType GetDataUsingDataContract(CompositeType composite) 
     { 
      if (composite == null) 
      { 
       throw new ArgumentNullException("composite"); 
      } 
      if (composite.BoolValue) 
      { 
       composite.StringValue += "Suffix"; 
      } 
      return composite; 
     } 
    } 
} 

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="WcfServiceLibrary4.Service1"> 
     <host> 
      <baseAddresses> 
      <!--<add baseAddress = "http://localhost:8733/Service1/" />--> 
      <add baseAddress="net.tcp://localhost:8734/Service1/"/> 
      </baseAddresses> 
     </host> 
     <!--<endpoint address="" binding="basicHttpBinding" contract="WcfServiceLibrary4.IService1"/> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>--> 
     <endpoint address="" binding="netTcpBinding" contract="WcfServiceLibrary4.IService1"/> 
     <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <serviceMetadata httpGetEnabled="False" httpsGetEnabled="False"/> 
      <serviceDebug includeExceptionDetailInFaults="False" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

내가 이 서비스를 추가하는 데 실패 VS2010 IDE 다음 점점 오류에서 애플 리케이션라는 실행하고 내 전체 코드가 촬영. 서비스 메타 데이터에 액세스 할 수 없습니다. 서비스가 실행 중이고 메타 데이터가 노출되어 있는지 확인하십시오.

그래서 구글 검색이 URL에서 나는 몇 가지 서비스 http://rohitguptablog.wordpress.com/2011/06/16/configuring-wcf-service-with-nettcpbinding/

enter image description here

하지만 난 후 해당 서비스를 시작하려고하면 내가 점점 오전 오류 enter image description here

을 시작한다는 것을 알게되었다

그래서 이러한 서비스를 시작할 수있는 방법에 대해 자세히 안내해주세요. 결과적으로 내 PC에서 TCP 연결을 사용하여 wcf 응용 프로그램을 테스트 할 수있는 다른 작업을 vs2010 ide에서 가져옵니다. 감사합니다

답변

1

IIS에서 NET.TCP를 활성화 했습니까?

은 아래를 참조하십시오 :

http://randypaulo.wordpress.com/2011/11/14/iis-7-how-to-enable-net-tcp/ Enabling net.tcp in IIS7

+0

을 그때 내가 오류를 얻고있다 WCF 테스트 클라이언트에서 내 서비스를 테스트하고 기본적으로 할 때. 그래서 나는 iis에 대해 생각하지 않습니다. 나는 문제가 다음 wcf 테스트 클라이언트 외침과 내 코드 또는 구성 코드에있을 수 있습니다 또는 몇 가지 문제가있을 것 같아요 아니면 내가 몇 가지 서비스를 시작해야 할 것 같아요. 서비스를 시작하려고하지만 오류가 발생했습니다. 그러니 그 서비스를 어떻게 시작할 수 있을지 말해 주시겠습니까? 설치해야 할 것이 있으면 말해주세요. 감사합니다 – Thomas

+0

net tcp 포트 공유 서비스를 시작 했습니까? http://msdn.microsoft.com/en-us/library/ms733925(v=vs.110).aspx –

+0

자체 호스팅 또는 IIS 호스팅을 사용하고 있습니까? –