For configuration without .SVC files, you only need to specify the relative address ending in .svc and the full name of the service implementation. But the problem lies here, it needs to be in <>
<services>
<host>
<baseAddresses>
<add baseAddress="http://localhost:10045/TestService/TestService" />
<add baseAddress="://localhost:10046/TestService/TestService" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsHttpSession" contract="" />
</services>
This configuration method clearly specifies the binding of the endpoint for a specific protocol, but the endpoint of the configuration without .svc is generated by AppFabric and does not need to be configured in the configuration file. For binding, only an interface-based configuration method is provided and the specific type of binding is not specified. The problem like the above is because the developed WCF requires a session, and the default binding based on the HTTP protocol BasicHttpBinding does not support sessions. So how to solve this problem is just to modify the default binding of the http protocol.
Solution:
Find the <> segment in the configuration file.
Add between <></>
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="WsHttpSession"/>
</protocolMapping>
Protocol mapping configuration, so that when the server receives a request for the http protocol, it will process the set binding according to the set binding instead of the default binding anymore.
Copy the codeThe code is as follows:
<services>
<host>
<baseAddresses>
<add baseAddress="http://localhost:10045/TestService/TestService" />
<add baseAddress="://localhost:10046/TestService/TestService" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsHttpSession" contract="" />
</services>
This configuration method clearly specifies the binding of the endpoint for a specific protocol, but the endpoint of the configuration without .svc is generated by AppFabric and does not need to be configured in the configuration file. For binding, only an interface-based configuration method is provided and the specific type of binding is not specified. The problem like the above is because the developed WCF requires a session, and the default binding based on the HTTP protocol BasicHttpBinding does not support sessions. So how to solve this problem is just to modify the default binding of the http protocol.
Solution:
Find the <> segment in the configuration file.
Add between <></>
Copy the codeThe code is as follows:
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="WsHttpSession"/>
</protocolMapping>
Protocol mapping configuration, so that when the server receives a request for the http protocol, it will process the set binding according to the set binding instead of the default binding anymore.