Full Trust European Hosting

BLOG about Full Trust Hosting and Its Technology - Dedicated to European Windows Hosting Customer

WCF Hosting UK - HostForLIFE.eu :: Binding and Behavior in WCF

clock June 28, 2019 11:26 by author Peter

In this article I will clarify about the Binding and Behavior of WCF. It is one of the principal of WCF. Binding represents how the client can communicate with the service.

Assume we need to make the service for two clients , first client will access SOAP using HTTP and second client access Binary using TCP. Utilizing webservice it is impossible yet utilizing WCF we can do by including additional endpoint in the configuration file. Example: in web.config.
<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true"targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="MathService"
        behaviorConfiguration="MathServiceBehavior">
        <endpoint
          address="http://localhost:9080/Service1.svc"contract="IMathService"
           binding="wsHttpBinding"/>
<endpoint address="net.tcp://localhost:8080/MyService/MathService.svc"
       contract="IMathService"
                  binding="netTcpBinding"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
     </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

And now, I’ll tell you about the Behaviour at the service level. In the service behavior, I have mention the servieMetadata node with attribute httGetEnabled='true'. This attribute will specifies the publication of the service metadata. Similarly we can add more behavior to the service. <system.serviceModel>
  <services>
    <service name="MathService"
      behaviorConfiguration="MathServiceBehavior">
      <endpoint address="" contract="IMathService"
        binding="wsHttpBinding"/>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="MathServiceBehavior">
        <serviceMetadata httpGetEnabled="True"/>
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

HostForLIFE.eu European WCF Hosting

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



European VB.NET Hosting - HostForLIFE.eu :: Drawing rubber-band lines and shapes in VB.NET

clock June 21, 2019 11:13 by author Peter

The lack of XOR Drawing feature in GDI+ was not certainly welcome in the programmer's community. I guess it will be hard to survive with this handicap.

In spite of this, I would like to show how we can draw rubber-band lines and shapes in GDI+ with just a few lines of code.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
Dim size As Size = SystemInformation.PrimaryMonitorMaximizedWindowSize 
bitmap = New Bitmap(size.Width, size.Height) 
gB = Graphics.FromImage(bitmap) 
Dim bckColor As Color = Me.BackColor 
gB.Clear(bckColor) 
End Sub 
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.MouseEventArgs) 
Dim p As Point = New Point(e.X, e.Y) 
x0 = p.X 
y0 = p.Y 
drag = True 
End Sub 
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.MouseEventArgs) 
Dim p As Point = New Point(e.X, e.Y) 
x= p.X 
y = p.Y 
Dim cx As Integer = x - x0 
Dim cy As Integer = y - y0 
If drag Then 
Dim gx As Graphics = CreateGraphics() 
gx.DrawImage(bitmap, 0, 0) 
gx.Dispose() 
Dim g As Graphics = CreateGraphics() 
Dim pen As Pen = New Pen(Color.Blue) 
Select Case DrawMode
Case 1 
g.DrawLine(pen, x0, y0, x, y) 
Exit Select 
Case 2 
g.DrawEllipse(pen, x0, y0, cx, cy) 
Exit Select 
Case 3 
g.DrawRectangle(pen, x0, y0, cx, cy) 
Exit Select 
End Select 
g.Dispose() 
pen.Dispose() 
End If 
End Sub 
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.MouseEventArgs) 
Dim cx As Integer = x - x0 
Dim cy As Integer = y - y0 
Dim pen As Pen = New Pen(Color.Blue) 
Select Case DrawMode 
Case 1 
gB.DrawLine(pen, x0, y0, x, y) 
Exit Select 
Case 2 
gB.DrawEllipse(pen, x0, y0, cx, cy) 
Exit Select 
Case 3 
gB.DrawRectangle(pen, x0, y0, cx, cy) 
Exit Select 
End Select 
drag = False 
pen.Dispose() 
End Sub 
Private Sub Form1_Paint(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.PaintEventArgs) 
Dim gx As Graphics = CreateGraphics() 
gx.DrawImage(bitmap, 0, 0) 
gx.Dispose() 
End Sub 
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)button1.ForeColor = Color.Red 
button2.ForeColor = Color.Black 
button3.ForeColor = Color.Black 
DrawMode = 1 
End Sub 
Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) 
button2.ForeColor = Color.Red 
button1.ForeColor = Color.Black 
button3.ForeColor = Color.Black 
DrawMode = 2 
End Sub 
Private Sub button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) 
button3.ForeColor = Color.Red 
button1.ForeColor = Color.Black 
button2.ForeColor = Color.Black 
DrawMode = 3 
End Sub 
Private Sub panel1_Paint(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.PaintEventArgs) 
button1.ForeColor = Color.Red 
button1.Focus() 
End Sub



About HostForLIFE

HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Tag cloud

Sign in