简体   繁体   中英

Changing a WCF service from WSDualHHTP to NETTCP error

I have a WCF service set up as a WSDuallHTTP and everything works ok using this. The problem I have is that I need to be able to get the service to run as a non admin program. I know I can setup the WCF service so that an admin just has to grant right for the service to be able to run on a certain port range but If I can get rid of the need for admins altogether it would be much better.

Due to this I have read that the NETTCP binding both supports duplex and doesnt require admin rights to host the service. My first question is is this correct?

Also when I change the WSDualHTTP binding to a NETTCP binding I get the following error.

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

Here is the code thats failing:

string WCFHost = string.Format(WCF_URL, MainConfiguration.WCFCommunicationsURL,
                MainConfiguration.WCFCommunicationsPort);

                this.serviceHost = new ServiceHost(typeof(GX3WCFServerService), new Uri(WCFHost));
                NetTcpBinding binding = new NetTcpBinding();
                binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
                this.serviceHost.AddServiceEndpoint(typeof(IGX3WCFServerService), binding, "");
                //the line above it the one throwing the exception

Please let me know if you need anymore information.

Worked out what the problem was. my WCFHost string began with HTTP:\\ instead of NET.TCP:\\

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM