WCF REST deployment Error: "Resource Does not exist" - wcf

I am trying to access http://localhost/tempservicehost/tempservice.svc and I am getting the following error:
Error Description: 'Resource does not
exist'
This may be because an invalid URI or
HTTP method was specified. Please see
the service help page for constructing
valid requests to the service.
The funny thing is that http://localhost/tempservicehost/tempservice.svc/help is working fine. Not only that, all my endpoints are working fine.
I am using IIS 7.5 (Win 2008 R2). Application developed using .NET 4.0
Post Updated (following is the code):
<ServiceContract()>
Public Interface ITestSvc
<OperationContract()>
<Description("")>
<WebInvoke(Bodystyle:=WebMessageBodyStyle.Bare,
Method:="POST",
UriTemplate:="GetCodes")>
Function GetCodes(ByVal oReq As ReqGetCodes) As RespGetCodes
End Interface
Public Class TestSvc
Implements ITestSvc
Public Function GetCodes(ByVal oReq As ReqGetCodes) As RespGetCodes Implements ITestSvc.GetCodes
Dim o As New RespGetCodes
Dim lstGetCodes = New List(Of ClassGetCodes) From {
New ClassGetCodes With {.App_Code = "a1", .SystemFlag = True},
New ClassGetCodes With {.App_Code = "a2", .SystemFlag = False},
New ClassGetCodes With {.App_Code = "a3", .SystemFlag = True},
New ClassGetCodes With {.App_Code = "a4", .SystemFlag = True},
New ClassGetCodes With {.App_Code = "a5", .SystemFlag = False}
}
o.GetCodesArray = lstGetCodes.ToArray
Return o
End Function
End Class
Public Class TestWebHttpBehavior
Inherits WebHttpBehavior
Protected Overrides Sub AddServerErrorHandlers(ByVal endpoint As System.ServiceModel.Description.ServiceEndpoint, ByVal endpointDispatcher As System.ServiceModel.Dispatcher.EndpointDispatcher)
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Clear()
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(New TestErrorHandler)
End Sub
End Class
Public Class TestWcfSvcHostFactory
Inherits ServiceHostFactory
Protected Overrides Function CreateServiceHost(ByVal serviceType As Type, ByVal baseAddresses As Uri()) As ServiceHost
Dim result As New WebServiceHost2(serviceType, True, baseAddresses)
Dim sEnableBasicAuth As String = System.Configuration.ConfigurationManager.AppSettings.Get("EnableBasicAuthentication")
If String.IsNullOrEmpty(sEnableBasicAuth) OrElse String.Compare(sEnableBasicAuth, "false", True) <> 0 Then
result.Interceptors.Add(New TestRequestInterceptor(System.Web.Security.Membership.Provider, "Personify Authentication"))
End If
result.Authorization.PrincipalPermissionMode = PrincipalPermissionMode.None
Dim bahavior As New TestWebHttpBehavior With {.AutomaticFormatSelectionEnabled = True}
result.Description.Endpoints(0).Behaviors.Add(bahavior)
Return result
End Function
End Class
Public Class TestRequestInterceptor
Inherits RequestInterceptor
Private m_provider As MembershipProvider
Private m_realm As String
Public Sub New(ByVal provider As MembershipProvider, ByVal realm As String)
MyBase.New(False)
Me.m_provider = provider
Me.m_realm = realm
End Sub
Protected ReadOnly Property Realm() As String
Get
Return m_realm
End Get
End Property
Protected ReadOnly Property Provider() As MembershipProvider
Get
Return m_provider
End Get
End Property
Public Overrides Sub ProcessRequest(ByRef requestContext As RequestContext)
Dim credentials As String() = ExtractCredentials(requestContext.RequestMessage)
If credentials.Length > 0 AndAlso AuthenticateUser(credentials(0), credentials(1)) Then
InitializeSecurityContext(requestContext.RequestMessage, credentials(0))
Else
Dim reply As Message = Message.CreateMessage(MessageVersion.None, Nothing)
Dim responseProperty As New HttpResponseMessageProperty() With {.StatusCode = HttpStatusCode.Unauthorized}
responseProperty.Headers.Add("WWW-Authenticate", String.Format("Basic realm=""{0}""", Realm))
reply.Properties(HttpResponseMessageProperty.Name) = responseProperty
requestContext.Reply(reply)
requestContext = Nothing
End If
End Sub
Private Function AuthenticateUser(ByVal username As String, ByVal password As String) As Boolean
If Provider.ValidateUser(username, password) Then
Return True
End If
Return False
End Function
Private Function ExtractCredentials(ByVal requestMessage As Message) As String()
Dim request As HttpRequestMessageProperty = DirectCast(requestMessage.Properties(HttpRequestMessageProperty.Name), HttpRequestMessageProperty)
Dim authHeader As String = request.Headers("Authorization")
If authHeader IsNot Nothing AndAlso authHeader.StartsWith("Basic") Then
Dim encodedUserPass As String = authHeader.Substring(6).Trim()
Dim encoding__1 As Encoding = Encoding.GetEncoding("iso-8859-1")
Dim userPass As String = encoding__1.GetString(Convert.FromBase64String(encodedUserPass))
Dim separator As Integer = userPass.IndexOf(":"c)
Dim credentials As String() = New String(1) {}
credentials(0) = userPass.Substring(0, separator)
credentials(1) = userPass.Substring(separator + 1)
Return credentials
End If
Return New String() {}
End Function
Private Sub InitializeSecurityContext(ByVal request As Message, ByVal username As String)
Dim principal As New GenericPrincipal(New GenericIdentity(username), New String() {})
Dim policies As New List(Of IAuthorizationPolicy)()
policies.Add(New PrincipalAuthorizationPolicy(principal))
Dim securityContext As New ServiceSecurityContext(policies.AsReadOnly())
If request.Properties.Security IsNot Nothing Then
request.Properties.Security.ServiceSecurityContext = securityContext
Else
request.Properties.Security = New SecurityMessageProperty() With { _
.ServiceSecurityContext = securityContext _
}
End If
End Sub
Private Class PrincipalAuthorizationPolicy
Implements IAuthorizationPolicy
Private m_id As String = Guid.NewGuid().ToString()
Private user As IPrincipal
Public Sub New(ByVal user As IPrincipal)
Me.user = user
End Sub
Public ReadOnly Property Id As String Implements System.IdentityModel.Policy.IAuthorizationComponent.Id
Get
Return Me.m_id
End Get
End Property
Public Function Evaluate(ByVal evaluationContext As System.IdentityModel.Policy.EvaluationContext, ByRef state As Object) As Boolean Implements System.IdentityModel.Policy.IAuthorizationPolicy.Evaluate
evaluationContext.AddClaimSet(Me, New DefaultClaimSet(Claim.CreateNameClaim(user.Identity.Name)))
evaluationContext.Properties("Identities") = New List(Of IIdentity)(New IIdentity() {user.Identity})
evaluationContext.Properties("Principal") = user
Return True
End Function
Public ReadOnly Property Issuer As System.IdentityModel.Claims.ClaimSet Implements System.IdentityModel.Policy.IAuthorizationPolicy.Issuer
Get
Return ClaimSet.System
End Get
End Property
End Class
End Class
The config is here:
<system.serviceModel>
<services>
<service behaviorConfiguration="TestWcfServiceBehavior"
name="TestServiceLib.TestSvc">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="EPrestBehavior"
name="EPrest" contract="TestServiceLib.ITestSvc" />
<endpoint address="mex" binding="mexHttpBinding" name="EPmex"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EPrestBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="TestWcfServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

I Had a similar issue,
I found that if i navigated to an actual resource it was fine.
for example
http://localhost/tempservicehost/tempservice.svc/test/
assuming you have the following method as well
[OperationContract]
[WebGet(UriTemplate = "/test/")]
public Test TestMethod()
{
return new Test("Hello world");
}
what has happened here is that the standard 404 error that is normally returned has not been rendered the way you are expecting it to. (usually you get a blue header and a line saying service end point or similar)
If you want to customise your errors there is a question Custom Error Handling message for Custom WebServiceHost
That explains how to pick up error codes on the way through and modify the return.

Related

Visual Basic API returns an exception error

I am trying to build a new leg in a WebAPI that I have written in visual basic. The code I am trying to execute is this:
Public Class getDatabaseDataController
Inherits ApiController
Private product_information As getDatabaseData() = New getDatabaseData() _
{New getDatabaseData() With {
.return_response = "return response"
}}
Public Function GetCars(<FromUri> ByVal dbRequest As String) As IEnumerable(Of getDatabaseData)
Dim return_string As String = ""
Dim passedData As String = dbRequest
return_string = passedData
Dim mqResponse As getDatabaseData() = New getDatabaseData() _
{New getDatabaseData() With {
.return_response = Str(return_string)
}}
'Return product_information
Return mqResponse
End Function
End Class
I have a public class called getDatabaseData defined as follows:
Public Class getDatabaseData
Private _Return_Response As String
Public Property return_response() As String
Get
Return _Return_Response
End Get
Set(value As String)
_Return_Response = value
End Set
End Property
End Class
I call the API with this call:
http://localhost:12976/api/getDatabaseData?dbRequest=A
All I am trying to do at this point is have the API return the value A. When I debug the API and send in the request, this is what is returned:
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Argument 'Number' cannot be converted to a numeric value.
</ExceptionMessage>
<ExceptionType>System.InvalidCastException</ExceptionType>
I dont see anything in the code that would indicate a 'Numeric'. What am I missing?
Thanks in advance for any assistance.

Error while serializing datetime property

When i include datetime property in object and return it in wcf service then it gives error status 12152. Without datetime property in my object it works fine. Datetime property content is #1/22/2016 12:08:36 PM#.
How to make it work with datetime property?
wcf call
function populateEditAuditResultData(AuditID) {
CallWCFService('DataService.svc/GetAuditCase',
'{"AuditID": "' + AuditID + '"}',
function (result) { //success
},
function (jQXHR, textStatus, errorThrown) { //failure
}
);
}
wcf service
<OperationContract()> _
Public Function GetAuditCase(ByVal AuditID As Integer) As AuditCase
Return New AuditCase(AuditID)
End Function
constructor
Public Sub New(ByVal AuditID As String)
Me.AuditID = AuditID
Me.GetData()
End Sub
Public Sub GetData()
Dim conn = New DatabaseConnection()
Dim params = New List(Of SqlParameter)
If AuditID <> Nothing Then params.Add(New SqlParameter("AuditID", Me.AuditID))
Dim table = conn.RunSprocQuery(ReferenceData.prc_GetAuditCaseDetails, params.ToArray())
If table.Rows.Count > 0 Then
ReadAuditCase(table.Rows(0), Me)
End If
End Sub
Private Shared Sub ReadAuditCase(ByVal row As DataRow, ByRef AudCase As AuditCase, Optional ByVal IncludeOptionalFields As Boolean = True)
AudCase.AuditID = CInt(row("AuditID"))
AudCase.AuditTypeID = CInt(row("AuditTypeID"))
AudCase.AllocationOn = Convert.ToDateTime(row("AllocationOn"))
End Sub
Ok solved the problem by changing the time zone to UTC.
Alternatively it can be solved by using following code.
AudCase.AllocationOn = Convert.ToDateTime(row("AllocationOn")).ToUniversalTime()
Hope this help others.

Read XMLDocument with same Element names

I have to read XML document data which is here:
<root>
<cartype>Mercedes</cartype>
<production>2005</production>
<fuel>Diesel</fuel>
<color>Red</color>
<services>
<service>
<year>2006</year>
<km>47800</km>
<city>Stuttgart</city>
</service>
<service>
<year>2007</year>
<km>92125</km>
<city>FFM</city>
</service>
<service>
<km>180420</km>
<year>2009</year>
<city>Hannover</city>
</service>
</services>
<condition>Good</condition>
</root>
Then I read it as such:
Dim cartype As String
Dim fuel As String
Dim production As String
Dim color As String
Dim serviceyear() As String = {"", "", ""}
Dim servicekm() As String = {"", "", ""}
Dim sevicecity() As String = {"", "", ""}
Dim doc As XmlDocument = New XmlDocument()
doc.Load("mercedes.xml")
Dim root As XmlElement = doc.DocumentElement
Dim node As XmlNode = root.SelectSingleNode("production")
If Not node Is Nothing Then production = node.InnerText
node = root.SelectSingleNode("cartype")
If Not node Is Nothing Then cartype = node.InnerText
node = root.SelectSingleNode("fuel")
If Not node Is Nothing Then fuel = node.InnerText
node = root.SelectSingleNode("color")
If Not node Is Nothing Then color = node.InnerText
node = root.SelectSingleNode("services/service/year") '' first service year
If Not node Is Nothing Then serviceyear(0) = node.InnerText
node = root.SelectSingleNode("services/service/year") '' second service year
If Not node Is Nothing Then serviceyear(1) = node.InnerText
Reading nodes with unique element names is OK but I don't know how to read all "services" in array since showed code reads only first service. Services may be from 0 to undefined number of it. Function have to be as fast is possible since large number of xml's have to be readed in what is possible less time.
To read a variable number of <service> elements you will need to use SelectNodes instead of SelectSingleNode:
Dim services = root.SelectNodes("services/service")
You can then iterate over the <service> nodes:
For Each service In services
If service("year") IsNot Nothing Then
Dim year = service("year").InnerText
End If
Next
Personally, I would use LINQ to XML to parse the file (but that may be because I am obsessed with all things LINQ!). Combined with VB.NET's support for XML Literals it makes for some really nice looking code (IMHO).
Here is a complete example you can paste into LINQPad.
Sub Main
' Use XElememt.Load(fileName) to load from file
Dim xml =
<root>
<cartype>Mercedes</cartype>
<production>2005</production>
<fuel>Diesel</fuel>
<color>Red</color>
<services>
<service>
<year>2006</year>
<km>47800</km>
<city>Stuttgart</city>
</service>
<service>
<year>2007</year>
<km>92125</km>
<city>FFM</city>
</service>
<service>
<km>180420</km>
<year>2009</year>
<city>Hannover</city>
</service>
</services>
<condition>Good</condition>
</root>
Dim history = New ServiceHistory() With {
.CarType = xml.<cartype>.Value,
.Production = xml.<production>.Value,
.Fuel = xml.<fuel>.Value,
.Color = xml.<color>.Value,
.Condition = xml.<condition>.Value,
.Services = (
From svc In xml.<services>.<service>
Select New Service() With {
.Year = svc.<year>.Value,
.KM = svc.<km>.Value,
.City = svc.<city>.Value
}
).ToList()
}
history.Dump()
End Sub
' Define other methods and classes here
Public Class ServiceHistory
Public Property CarType As String
Public Property Production As String
Public Property Fuel As String
Public Property Color As String
Public Property Condition As String
Public Property Services As List(Of Service)
End Class
Public Class Service
Public Property Year As String
Public Property KM As String
Public Property City As String
End Class
This gives you the following:
Try linq it will be easier to parse the xml:
It have to be something like that:
xelement = XElement.Load(file);
services = xelement.Element("services").Elements("service");

How to I fix my deserialize error?

Why, hello everyone!
I've got this program i've been working on for months. Basic back story of it is, its supposed to be able to transport and install applications for windows in the background, like iCloud does for apps!
Anywho, i'm using a serialize/deserialize method to save the properties (eg admin username and passwordhash, directories, ports, etc.).
I have a class called 'PropertyNest' representing the properties and links to memory allocations. I'll cut it down to only the parts that the XMLSerializer looks at and saves.
Public Class PropertyNest
'Huge bunch of functions that we dont need to look at
'#######################
Public _wasLoadedFromFile As Boolean = False
Private _port As Integer = 201
Private _httpPort As Integer = 202
Private _rootFolder As String = "\appstreamRoot"
Private _adminUser As String = "Admin"
Private _adminPass As String = "21232F297A57A5A743894A0E4A801FC3" 'admin
Private _appstreamServerType As appStreamServerType = appStreamServerType.http
Private _useDES3forserver As Boolean = True
Private _encDES3pswd As String = "21232F297A57A5A743894A0E4A801FC3" 'admin
'Properties and descriptors for 'PropertyGrid' object go here \|/
'=================================================================
End Class
And its declared in the main window, serverMain like this,
Public Shared Property_Nest As AdvancedSettings.PropertyNest
and initialized later in like this,
If settingsfilename = "" Then
Property_Nest = New AdvancedSettings.PropertyNest()
Else
If propFileEncrypted = False Then
WriteLog("From unprotected file...", False)
Try
Property_Nest = AdvancedSettings.PropertyNest.LoadFrom(settingsfilename)
Catch ex As Exception
WriteLog("FAILED! Making default property nest...")
Property_Nest = New AdvancedSettings.PropertyNest()
End Try
Else
WriteLog("From encrypted file...", False)
Try
Property_Nest = AdvancedSettings.PropertyNest.LoadFrom(settingsfilename, True, propFilePswd)
Catch ex As Exception
WriteLog("FAILED! Making default property nest...", False)
Property_Nest = New AdvancedSettings.PropertyNest()
End Try
End If
End If
Thats all well and good. Loading it from the file that its saved to is the problem. Inside the PropertyNest class, I have 2 serializers programmed like so:
(Sorry its a bunch, there's optional encrypting of the serialized products with TrippleDES)
Public Sub SaveAs(ByVal filename As String, Optional ByVal Encrypted As Boolean = False)
Dim extra As String
If Encrypted = True Then : extra = "Encrypted? : Yes." : Else : extra = "Encrypted? : No."
End If
If filename = Nothing Then
Exit Sub
End If
writeLog2("Saving Property Nest to: " & filename & vbCrLf & extra, False)
If Encrypted = False Then
Dim writer As New Xml.Serialization.XmlSerializer(GetType(PropertyNest))
Dim file As New System.IO.StreamWriter(filename)
writer.Serialize(file, Me)
file.Close()
Else
Dim writer As New Xml.Serialization.XmlSerializer(GetType(PropertyNest))
Dim memstream As New System.IO.MemoryStream
writer.Serialize(memstream, Me)
memstream.Seek(0, IO.SeekOrigin.Begin)
Dim file As New System.IO.StreamWriter(filename)
Dim memstreamReader As New System.IO.StreamReader(memstream)
Do
file.WriteLine(serverMain.admin_des3Manager.Encrypt(memstreamReader.ReadLine()))
Loop Until memstreamReader.EndOfStream = True
file.Close()
End If
writeLog2("OK!")
End Sub
Shared Function LoadFrom(ByVal filename As String, Optional ByVal EncryptedWithPswd As Boolean = False, Optional ByVal Password As String = "") As PropertyNest
Dim reader As New Xml.Serialization.XmlSerializer(GetType(PropertyNest))
Dim file As New System.IO.StreamReader(filename)
Dim newPropNest As PropertyNest
If EncryptedWithPswd = False Then
newPropNest = reader.Deserialize(file) 'Error in XML Document(11, 3)
Else
If Password = "" Then
Dim convertedStream As New System.IO.MemoryStream
Dim convertedWriter As New System.IO.StreamWriter(convertedStream)
Do
convertedWriter.WriteLine(serverMain.admin_des3Manager.Decrypt(file.ReadLine()))
Loop Until file.EndOfStream = True
convertedWriter.Close()
newPropNest = reader.Deserialize(convertedStream)
Else
Dim tempDES3 As New DES3(Password)
Dim convertedStream As New System.IO.MemoryStream
Dim convertedWriter As New System.IO.StreamWriter(convertedStream)
Do
convertedWriter.WriteLine(tempDES3.Decrypt(file.ReadLine()))
Loop Until file.EndOfStream = True
convertedWriter.Close()
newPropNest = reader.Deserialize(convertedStream)
End If
End If
Return newPropNest
End Function
I marked the error in there.
Phew. Almost done.
i'm only worried about unencrypted right now, so i did my duty to save a custom, non default property nest, and it wrote to the file like so:
<?xml version="1.0" encoding="utf-8"?>
<PropertyNest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<_wasLoadedFromFile>false</_wasLoadedFromFile>
<ServerPort>2010</ServerPort>
<AdminUser>Matthew</AdminUser>
<AdminPasswordHash>21232F297A57A5A743894A0E4A801FC3</AdminPasswordHash>
<AppStreamPort>2020</AppStreamPort>
<AppStream_ServerRoot>\appstreamRoot</AppStream_ServerRoot>
<UseDES3>true</UseDES3>
<EncDES3Pswd>21232F297A57A5A743894A0E4A801FC3</EncDES3Pswd>
</PropertyNest>
Awesome! now.... If you look at the 'LoadFrom' function, you'll see i commented the line where i get the error... I dont see an error at 11, 3. Please help!
Thanks so much :D
Your XML is valid, however the class you need to deserialise, should be like this according to visual studio, copy you XML to the clipboard, go to the edit menu, paste special and past XML as classes give you this, give it a try see if it works, you can use a c# to vb converter to change to VB if you need to.
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class PropertyNest
{
private bool _wasLoadedFromFileField;
private ushort serverPortField;
private string adminUserField;
private string adminPasswordHashField;
private ushort appStreamPortField;
private string appStream_ServerRootField;
private bool useDES3Field;
private string encDES3PswdField;
/// <remarks/>
public bool _wasLoadedFromFile
{
get
{
return this._wasLoadedFromFileField;
}
set
{
this._wasLoadedFromFileField = value;
}
}
/// <remarks/>
public ushort ServerPort
{
get
{
return this.serverPortField;
}
set
{
this.serverPortField = value;
}
}
/// <remarks/>
public string AdminUser
{
get
{
return this.adminUserField;
}
set
{
this.adminUserField = value;
}
}
/// <remarks/>
public string AdminPasswordHash
{
get
{
return this.adminPasswordHashField;
}
set
{
this.adminPasswordHashField = value;
}
}
/// <remarks/>
public ushort AppStreamPort
{
get
{
return this.appStreamPortField;
}
set
{
this.appStreamPortField = value;
}
}
/// <remarks/>
public string AppStream_ServerRoot
{
get
{
return this.appStream_ServerRootField;
}
set
{
this.appStream_ServerRootField = value;
}
}
/// <remarks/>
public bool UseDES3
{
get
{
return this.useDES3Field;
}
set
{
this.useDES3Field = value;
}
}
/// <remarks/>
public string EncDES3Pswd
{
get
{
return this.encDES3PswdField;
}
set
{
this.encDES3PswdField = value;
}
}
}

WCF AfterReceiveRequest not firing

I am using a self hosted WCF service and I am getting a little strange behavior from my service:
I use an Implementation of IDispatchMessageInspector to keep track of the requests/responses processed by my service.
When I add my service by using "Add service reference dialog" everything works fine. AfterReceivedRequest and BeforeSendReply is fired.
When I create the binding/endpoint using code only the service works fine, but AfterReceivedRequest and BeforeSendReply is not fired.
I'd be very happy if someone could point me in the right direction.
Marco.
Edit: here is the Code of the client creation:
Public Shared Function Do_RM(ByVal RMParameter As roClsRMParameter) As ROD.RM.Services.RoClsRMResult
Dim StartAdresse As String
Dim myBinding As BasicHttpBinding
Dim oRes As ROD.RM.Services.RoClsRMResult = Nothing
myBinding = Create_Binding()
myBinding.OpenTimeout = New TimeSpan(0, 0, TimeOutInSekunden)
myBinding.SendTimeout = New TimeSpan(0, 0, TimeOutInSekunden)
StartAdresse = "http://MyServer:8731/BASIC"
Dim Address = New EndpointAddress(StartAdresse)
Dim Client = New ROD.RM.Services.RODIS_QS_RMClient(myBinding, Address)
Client.Endpoint.Contract = Create_ContractDescription()
Client.Open()
oRes = Client.DoRM(RMParameter.A_BEL,
RMParameter.A_POS,
RMParameter.AVO,
RMParameter.Qualitaet,
RMParameter.Fehlernummer,
RMParameter.Anlage,
RMParameter.ChargenNr,
RMParameter.EinzelRueckmeldung,
RMParameter.NurTest,
RMParameter.Standort)
Client.Close()
Return oRes
End Function
Private Shared Function Create_ContractDescription() As ContractDescription
Dim oContract As ContractDescription
oContract = ContractDescription.GetContract(GetType(ROD.RM.Services.IRODIS_QS_RM), GetType(ROD.RM.Services.RODIS_QS_RMClient))
Return oContract
End Function
Private Shared Function Create_Binding() As BasicHttpBinding
Dim oHttpBinding As BasicHttpBinding = New BasicHttpBinding()
oHttpBinding.Name = "BasicHttpBinding_IRODIS_QS_RM"
oHttpBinding.CloseTimeout = TimeSpan.FromMinutes(1)
oHttpBinding.OpenTimeout = TimeSpan.FromMinutes(1)
oHttpBinding.ReceiveTimeout = TimeSpan.FromMinutes(10)
oHttpBinding.SendTimeout = TimeSpan.FromMinutes(1)
oHttpBinding.BypassProxyOnLocal = False
oHttpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
oHttpBinding.MaxBufferPoolSize = 524288
oHttpBinding.MaxReceivedMessageSize = 65536
oHttpBinding.MessageEncoding = WSMessageEncoding.Text
oHttpBinding.TextEncoding = Encoding.UTF8
oHttpBinding.UseDefaultWebProxy = True
oHttpBinding.AllowCookies = False
oHttpBinding.ReaderQuotas.MaxDepth = 32
oHttpBinding.ReaderQuotas.MaxArrayLength = 16384
oHttpBinding.ReaderQuotas.MaxStringContentLength = 8192
oHttpBinding.ReaderQuotas.MaxBytesPerRead = 4096
oHttpBinding.ReaderQuotas.MaxNameTableCharCount = 16384
Return oHttpBinding
End Function
Here are the parts for the Inspector of the Service:
Imports System.ServiceModel.Description
Public Class roClsRMLogBehavior
Implements IEndpointBehavior
Public Sub ApplyDispatchBehavior(ByVal endpoint As _
System.ServiceModel.Description.ServiceEndpoint, ByVal _
endpointDispatcher As _
System.ServiceModel.Dispatcher.EndpointDispatcher) _
Implements System.ServiceModel.Description.IEndpointBehavior.ApplyDispatchBehavior
Dim oInspector As roClsRMLog
oInspector = New roClsRMLog
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(oInspector)
End Sub
End Class
In the app.Config:
<extensions>
<behaviorExtensions>
<add name="roClsRMLogBehavior" type="RODIS_QS_BUCHEN_SERVICE.roclsRMLogBehaviorExtensionElement, RODIS_QS_BUCHEN_SERVICE, Version=1.1.3.1,Culture=neutral,PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>