Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <system.serviceModel>
  2. <services>
  3. <!-- This section is optional with the default configuration introduced
  4. in .NET Framework 4. -->
  5. <service name="WCF_Example.Service1" behaviorConfiguration="mexBehavior">
  6. <endpoint address="WCF_ServiceExample" binding="basicHttpBinding" contract="WCF_Example.IService1" />
  7. <endpoint address="WCF_ServiceExample" binding="netTcpBinding" contract="WCF_Example.IService1" />
  8. <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  9. <host>
  10. <baseAddresses>
  11. <add baseAddress="http://localhost:61940/"/>
  12. <add baseAddress="net.tcp://localhost:61940/"/>
  13. </baseAddresses>
  14. </host>
  15. </service>
  16. </services>
  17.  
  18. <bindings>
  19. <basicHttpBinding>
  20. <binding name="transportSecurity">
  21. <security mode="TransportWithMessageCredential">
  22. <message clientCredentialType="UserName" />
  23. </security>
  24. </binding>
  25. </basicHttpBinding>
  26. </bindings>
  27.  
  28. <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
  29. <behaviors>
  30. <serviceBehaviors>
  31. <behavior name="mexBehavior">
  32. <serviceMetadata httpGetEnabled="True"/>
  33. <serviceDebug includeExceptionDetailInFaults="False" />
  34. </behavior>
  35. </serviceBehaviors>
  36. </behaviors>
  37. </system.serviceModel>
  38.  
  39. public ActionResult Index()
  40. {
  41. using (ServiceHost host = new ServiceHost(typeof(WCF_Example.Service1)))
  42. {
  43. host.Open();
  44.  
  45. }
  46.  
  47. return View();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement