0

I am using VS2015 and creating a WPF client app for a web service. The service is running on IIS on my network on a dedicated web server. When I try to add a service reference I get an error message that says it cannot recognize the uri prefix.

The web service web.config file is as follows:

<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
  <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
  <netTcpBinding>
    <binding name="netTcpBinding-Streamed" transferMode="Streamed" maxReceivedMessageSize="1073741824">
      <readerQuotas maxStringContentLength="8192000" />
    </binding>
  </netTcpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceAuthorization principalPermissionMode="UseWindowsGroups" />
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
<service name="[Namespace].Services.IIS">
    <endpoint address="net.tcp://[server:port]/[website on iis]/Shared/Shared.svc" bindingConfiguration="netTcpBinding-Streamed" binding="netTcpBinding" contract="[Namespace].Services.Interfaces.Shared.IShared" />
        <endpoint address="net.tcp://[server:port]/[website on iis]/UITax/Reports.svc" bindingConfiguration="netTcpBinding-Streamed" binding="netTcpBinding" contract="[Namespace].Services.Interfaces.UITax.Reports.IReport" />
        <endpoint address="net.tcp://[server:port]/[website on iis]/UITax/Assignments.svc" bindingConfiguration="netTcpBinding-Streamed" binding="netTcpBinding" contract="[Namespace].Services.Interfaces.UITax.Assignments.IAssignments" />
    </service>
</services>
<extensions>
  <behaviorExtensions>
    <add name="errorHandler" type="[Namespace].Services.Framework.WCF.WcfErrorHandlerExtension, [Namespace].Services.WCF.Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </behaviorExtensions>
</extensions>

I enter "net.tcp://[server:port]/[website on iis]/Shared/Shared.svc" into the Address box and click GO and get the error.

What am I doing wrong?

VS2015 error message:

The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://[server:port]/[website on iis]/shared/shared.svc'.
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.9980001'.
An existing connection was forcibly closed by the remote host
If the service is defined in the current solution, try building the solution and adding the service reference again.
Nerdherder Ed
  • 45
  • 1
  • 7
  • If you want to generate a service reference, the metadata must go over HTTP according to [this](http://stackoverflow.com/questions/1130366/wcf-nettcpbinding-with-mex) or [this](http://stackoverflow.com/questions/17886007/net-tcp-binding-the-uri-prefix-is-not-recognized) question. – CodeCaster Oct 21 '15 at 21:29
  • 1
    Please include the error message in your post. – Jason D Oct 21 '15 at 21:39
  • CodeCaster: As to your first reference link - Other apps are using the web service but I do not have access to the source code. So I am assuming the web.config file is not an issue. – Nerdherder Ed Oct 21 '15 at 21:53
  • CodeCaster: As to your second reference link the service project is not part of my solution or project. Plus setting "httpGetEnabled=true" broke all the existing apps that are using the service. – Nerdherder Ed Oct 21 '15 at 21:56

1 Answers1

0

as CodeCaster said in comment to the question, you should enable metadata publishing (<serviceMetadata httpGetEnabled="true" />) and add mex endpoint of type mexHttpBinding (so use http://[server:port]/[website on iis]/UITax/Reports.svc) to add service reference. OR add mex endpoint of type mexTcpBinding and use your net.tcp addresses to add service reference

Endpoints for metadata exchange:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

Or

<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
Mimas
  • 525
  • 3
  • 7
  • I am not sure what you are suggesting. Do I need to change the endpoint in the servers web config – Nerdherder Ed Oct 22 '15 at 13:14
  • I am not sure what you are suggesting. Do I need to change the endpoint address in the server's web.config file to just "mex"? Also, as I mentioned above in reply to CodeCaster, when I change httpGetEnabled from "false" to "true" breaks all the other apps using this service. – Nerdherder Ed Oct 22 '15 at 13:22
  • not change the name, but add one more endpoint. Just add this line right after already existing endpoint – Mimas Oct 22 '15 at 13:40
  • Please see very detailed description here https://msdn.microsoft.com/en-us/library/ms734765.aspx – Mimas Oct 22 '15 at 13:43
  • I added another endpoint to the web.config file: And changed httpGetEnabled to true. I am still getting the same error message. – Nerdherder Ed Oct 22 '15 at 15:45