Not able to WCF service reference to MVC project using net.tcp

Sushant Sinha 1 Reputation point
2020-10-03T05:10:54.41+00:00

My project is using MVC with WCF for 5 years and the code hasn't changed much. Recently my laptop got replaced since then I am facing trouble adding a service reference to MY WCF services in my MVC project. Please find the error, IIS configuration and Windows features screenshot.

OS Win10 Pro

IIS 10
29906-1.jpg

29974-2.jpg

29957-3.jpg

29975-4.jpg

29976-5.jpg

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,571 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Peng Ding-MSFT 96 Reputation points
    2020-10-06T02:28:13.567+00:00

    If you want to deploy the wcf service to IIS, you need to add a mex endpoint, here is a demo:

    <?xml version="1.0" encoding="utf-8" ?>  
    <configuration>  
    	<system.serviceModel>  
    		<services>  
    			<service name="WcfService1.Service1" behaviorConfiguration="CalculatorServiceBehaviors">  
      
    				  
    				<endpoint address=""  
    						  binding="netTcpBinding"  
    						  contract="WcfService1.IService1" />  
      
    				  
    				<endpoint address="mex"  
    						  binding="mexTcpBinding"  
    						  contract="IMetadataExchange" />  
    			</service>  
    		</services>  
      
    		<behaviors>  
    			<serviceBehaviors>  
    				<behavior name="CalculatorServiceBehaviors">  
    					  
    					<serviceMetadata httpGetEnabled="false" />  
    				</behavior>  
    			</serviceBehaviors>  
    		</behaviors>  
    	</system.serviceModel>  
      
    </configuration>  
    

    Don't forget to set the value of httpGetEnabled to false.

    After successful deployment, we can find the service in the browser:

    30246-1.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments