I was trying to make a webservice call to return json formatted data to populated a grid control. It was not working and after using fiddler and firebug to monitor the call I see the data wrapped as xml. I tried to different calls; one makes a call to mongodb and the result is a simply collection and the other is data from another endpoint that is json format. I have the webservice set up as follows:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Web.Script.Services
Imports System.Web.Script.Serialization
Imports System.Net
Imports System.IO
Imports System.Xml
Imports Newtonsoft.Json
Imports System.ServiceModel
Imports MongoDB.Driver
Imports MongoDB.Bson
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ServiceBehaviorAttribute(IncludeExceptionDetailInFaults:=True)>
<ToolboxItem(False)> _
Public Class WebService1
Inherits System.Web.Services.WebService
Private mongo As MongoServer = MongoServer.Create()
Private Function convertToJson(ByVal username As String)
Dim product As New splnkObject()
product.userName = username
Dim jsonT As String = JsonConvert.SerializeObject(product)
Return jsonT
End Function
<WebMethod()> _
<ScriptMethod(UseHttpGet:=True,
XmlSerializeString:=False, ResponseFormat:=ResponseFormat.Json)> _
Public Function getDBData() As String
Dim response As String = String.Empty
mongo.Connect()
Dim db = mongo.GetDatabase("nodetest1")
Using mongo.RequestStart(db)
Dim collection = db.GetCollection(Of BsonDocument)("usercollection").FindAll()
response = collection.Collection.ToString
response = "{""d"":" + response + "}"
Return collection.ToArray.ToJson
End Using
End Function
This is the response captured in fiddler and the json tab says invalid json in body:
string [ xmlns=http://tempuri.org/ ]
[{ "_id" : ObjectId("52d2f2b3c60804b25bc5d2ca"), "username" : "testuser1",
"email" : "testuser1#testdomain.com" },
{ "_id" : ObjectId("52d2f2f9c60804b25bc5d2cb"), "username" : "testuser2",
"email" : "testuser2#testdomain.com" },
{ "_id" : ObjectId("52d2f2f9c60804b25bc5d2cc"), "username" : "testuser3",
"email" : "testuser3#testdomain.com" }]
My webconfig file as follows:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="connectionString2" value="Server=localhost:27017"/>
</appSettings>
<connectionStrings>
<system.web>
<authentication mode="None" />
<authorization>
<allow users="?" />
</authorization>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx"
type="System.Web.Script.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="true" />
<services>
<service name="WbTest.Service1">
<endpoint address="" behaviorConfiguration="WbTest.Service1AspNetAjaxBehavior"
binding="webHttpBinding" contract="WbTest.IService1" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp />
<enableWebScript />
</behavior>
<behavior name="WbTest.Service1AspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings />
<client />
</system.serviceModel>
</configuration>
The javascript call:
var myStore = new Ext.data.Store({
model: 'User',
proxy: {
type: 'ajax',
url: 'WCFService/WebService1.asmx/getDBData',
contentType: 'application/json; charset=utf-8',
reader: {
type: 'json',
root: '_id'
}
}
});
myStore.load();
Please could someone take a look and identify where the issue is.
I'm not going to say this is the "right" way, however, one option would be to not specify a return type on the method and write directly to the response(HttpContext.Current.Response) object.
<WebMethod()> _
Public Sub getDBData()
Dim response As String = String.Empty
mongo.Connect()
Dim db = mongo.GetDatabase("nodetest1")
Using mongo.RequestStart(db)
Dim collection = db.GetCollection(Of BsonDocument)("usercollection").FindAll()
response = collection.Collection.ToString
response = "{""d"":" + response + "}"
Dim responseJson as String
responseJson = Collection.ToArray.ToJson
HttpContext.Current.Response.Write(responseJson)
End Using
End Sub
Additionally, If you are going to use Newtonsoft to manipulate objects, i find this method works well.
I should note, that asmx web services are legacy and the newer technology is wcf.
Related
I'm trying to get a handler to be called for the site root request by the browser, i.e. http://my.example.com. Given the code below, if I call /Test, the handler works as expected, but without that, I get the HTTP Error 403.14 - Forbidden (directory browsing isn't allowed).
Windows Server 2012-R2 / IIS 8.5
There is no MVC involved
ScriptModule-4.0 module is inherited so extensionless works
Similar to this question from 2012 that was never properly answered
Generic handler is given as an example...could also be a Soap Web Service
I've tried various combinations of slashes and asterisks for the handler path without success.
Generic handler:
Public Class Test
Implements IHttpHandler
Public Sub ProcessRequest(Context As HttpContext) _
Implements IHttpHandler.ProcessRequest
With New StringBuilder
.AppendLine("<html>")
.AppendLine("<head>")
.AppendLine("<title>Test</title>")
.AppendLine("</head>")
.AppendLine("<body>")
.AppendLine("<p>Hello World</p>")
.AppendLine("</body>")
.AppendLine("</html>")
Context.Response.Write(.ToString)
End With
End Sub
End Class
...and in web.config I have the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation strict="false" explicit="true" debug="true" targetFramework="4.5.2" />
<customErrors mode="Off" />
<authentication mode="Windows" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<system.webServer>
<handlers>
<add verb="*" name="Test" type="MyApp.Test" path="Test" />
</handlers>
<defaultDocument enabled="true">
<files>
<clear />
<add value="Test" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
The solution I came up with, but I'm open to other ideas.
In web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation strict="false" explicit="true" debug="true" targetFramework="4.5.2" />
<customErrors mode="Off" />
<authentication mode="Windows" />
<httpRuntime targetFramework="4.5.2" />
<!-- Required for Web Services via Handlers -->
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
</protocols>
</webServices>
</system.web>
<system.webServer>
<handlers>
<add verb="GET,POST" name="Test" type="MyApp.Test" path="Test" />
</handlers>
<modules>
<add name="AppModule" type="MyApp.AppModule" />
</modules>
<defaultDocument enabled="false" />
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
And then added the AppModule class where I evaluate HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath and do a HttpContext.Current.RewritePath so the handler defined above will pick it up.
my.example.com
my.example.com/AnyFolder/MyApplication
Matching for "~/" works if the web app is at the site root in IIS or is set up as an app within a site:
Public Class AppModule
Implements IHttpModule
Friend WithEvents WebApp As HttpApplication
Public Sub Init(ByVal HttpApplication As HttpApplication) _
Implements IHttpModule.Init
WebApp = HttpApplication
End Sub
Private Sub WebApp_BeginRequest(sender As Object, e As EventArgs) _
Handles WebApp.BeginRequest
With HttpContext.Current
If .Request.AppRelativeCurrentExecutionFilePath = "~/" Then .RewritePath("~/Test")
End With
End Sub
Public Sub Dispose() _
Implements IHttpModule.Dispose
Throw New NotImplementedException()
End Sub
End Class
I just created a basic Web Controller in my project. I hit debug and try to browse to /api/duedate and I get a 404. I am new to controllers and have been looking at every tutorial I can find. None of them say I need to add anything more to get this to work.
Imports System.Net
Imports System.Web.Http
Public Class DueDateController
Inherits ApiController
' GET api/duedate
Public Function GetValues() As IEnumerable(Of String)
Return New String() {"value1", "value2"}
End Function
' GET api/duedate/5
Public Function GetValue(ByVal id As Integer) As String
Return "value"
End Function
' POST api/duedate
Public Sub PostValue(<FromBody()> ByVal value As String)
End Sub
' PUT api/duedate/5
Public Sub PutValue(ByVal id As Integer, <FromBody()> ByVal value As String)
End Sub
' DELETE api/duedate/5
Public Sub DeleteValue(ByVal id As Integer)
End Sub
End Class
My web.config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="webPages:Version" value="2.0"/>
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
</configuration>
I believe you need to add a route.
Routing in VB
If you read the last comment in this thread it should show you how to add routing to your app.
To help anyone else out and to simplify having to read through that long post. You need to create and modify your global.asax file to include this:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RouteTable.Routes.MapHttpRoute("WebApi1",
"api/{controller}/{id}",
defaults:=New With {.id = System.Web.Http.RouteParameter.Optional})
End Sub
Here is the WCF POST Service with ajaxcallback. Its working fine on my side but not working on Client Side. It is giving error - POST http://localhost/WCFService/EService.svc/GetTIDFromRID 500 (internal server error).
Method:
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest
)]
string GetTIDFromRID(string RID);
Service Web.Config:
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\logs\northwindservices.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging
logEntireMessage="false"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"
maxMessagesToLog="500"
maxSizeOfMessageToLog="5000"/>
</diagnostics>
</system.serviceModel>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="None"></authentication>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<appSettings>
<add key="ConStr" value="Data Source=C002;Initial Catalog=TEST;User ID=sa;Password=sa"/>
</appSettings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="EcubeBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<!--<webHttp/>-->
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WCFService.EService" behaviorConfiguration="EBehavior">
<endpoint address="http://localhost/WCFService/EService.svc" behaviorConfiguration="web" binding="webHttpBinding" contract="WCFService.IEService"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost/WCFService/EService.svc"/>
</baseAddresses>
</host>
</service>
</services>
<standardEndpoints>
<webScriptEndpoint>
<standardEndpoint name="" crossDomainScriptAccessEnabled="true"/>
</webScriptEndpoint>
</standardEndpoints>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
</serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
Service Consumption:
$.ajax({
url: 'http://localhost/WCFService/EService.svc/GetTIDFromRID',
data: JSON.stringify({ "RID": "r1234" }),
dataType: 'json',
type: 'POST',
contentType: 'application/json; charset=utf-8',
success: function (data) {
},
error: function (data) {
alert('Response: Failed');
}
});
Please give some suggestion. Both Application and Service are hosted on different server. Permission is also given. Global.asax is also added which contains Header related code Access origin...
A 500 internal server error indicates that the error originates with the web service host.
In order to help track down the issue, you may want to consider configuring server-side WCF tracing, which will record operation calls, code exceptions, warnings and other significant processing events. Once WCF tracing is configured and enable, send the message that generates the http status 500 error and review the trace log for any underlying errors.
Use the WCF Service Configuration Editor (Visual Studio -> Tools menu) to set the system.diagnostics trace values and the corresponding system.serviceModel section of the configuration file (example entries below):
system.diagnostics
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener" initializeData="wcf_trace_log.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
system.serviceModel
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true"/>
</diagnostics>
https://msdn.microsoft.com/en-us/library/ms733025%28v=vs.110%29.aspx
I have been wracking my brain to get this one figured out. I followed the MSDN "Simplified Configuration" model here, for .net 4.0 - http://msdn.microsoft.com/en-us/library/ee358768.aspx
I get this error when I try and hit the URL - http://localhost:62392/GetBuildings.svc/GetBuildings?numberOfPeople=2,4&amountOfTime=1&needComputer=true&dateSelected=12/1/2012
The service seems to actually run, I don't get a full on IIS error, but I am not getting the data expected. How can I evaluate whether my endpoint is setup correctly?
my web.config -
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
<authentication mode="None"/>
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingJsonP" crossDomainScriptAccessEnabled="true"></binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="webHttpBindingJsonP" />
</protocolMapping>
</system.serviceModel>
</configuration>
my Interface -
Imports System.ServiceModel
Imports System.ServiceModel.Web
<ServiceContract()>
Public Interface IGetLibrariesService
<OperationContract(Name:="LibraryData")> _
<WebGet(ResponseFormat:=WebMessageFormat.Json)> _
Function GetLibraries(ByVal numberOfPeople As String, ByVal amountOfTime As Integer, ByVal needComputer As Boolean, ByVal dateSelected As String) As BuildingReturnData
End Interface
and last, my code -
<DataContract()>
Public Class BuildingReturnData
<DataMember()>
Public libData As List(Of LibraryMobileData)
<DataMember()>
Public numberOfRooms As List(Of Integer)
<DataMember()>
Public totalRecordCount As Integer
End Class
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allo wed)>
Public Class MeetingRooms : Implements IGetLibrariesService
Private _libData As New List(Of LibraryMobileData)
Private _roomCountData As New List(Of Integer)
Public Function GetBuildings(numberOfPeople As String, amountOfTime As Integer, needComputer As Boolean, dateSelected As String) As BuildingReturnData Implements IGetLibrariesService.GetLibraries
Dim libTemp As New LibraryMobileData
Dim startPeople, endPeople, recordCount As Integer
Dim numberSplitArr As String()
numberSplitArr = Split(numberOfPeople, ",")
startPeople = numberSplitArr(0)
endPeople = numberSplitArr(1)
For x = 0 To endPeople
libTemp.LibraryId = x
libTemp.Name = "library " & x
libTemp.Latitude = 39.167107
libTemp.Longitude = -86.534359
_libData.Add(libTemp)
_roomCountData.Add(x + startPeople)
recordCount = x
Next
Dim temp As New BuildingReturnData
temp.libData = _libData
temp.numberOfRooms = _roomCountData
temp.totalRecordCount = recordCount
Return temp
End Function
End Class
Allright, I'm using a WCF service to handle requests from my web app and respond with a JSONP format. I tried all the solutions I could find, studied the documentation (http://msdn.microsoft.com/en-us/library/ee834511.aspx#Y200) and the example project.
The problem is the response object (json) does not get wrapped with the callback supplied in the URL.
Request is like:
http://localhost/socialApi/socialApi.svc/api/login?callback=callback&username=AAAAA&password=BBBB
Web.config looks like:
<?xml version="1.0"?>
<configuration>
<system.web>
<trace enabled="true"/>
<compilation debug="true" targetFramework="4.0"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=*************" /></assemblies></compilation>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="RestService.socialApi">
<endpoint address="" binding="webHttpBinding" contract="RestService.IsocialApi" bindingConfiguration="webHttpBindingJsonP" behaviorConfiguration="webHttpBehavior">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- 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="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior" >
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingJsonP" crossDomainScriptAccessEnabled="true"/>
</webHttpBinding>
</bindings>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />-->
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings>
<add name="AsrAppEntities" connectionString="myconstring**********" />
</connectionStrings>
</configuration>
And my operationcontract:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using System.IO;
namespace socialApi
{
[ServiceContract]
public interface IsocialApi
{
[OperationContract]
[WebGet(
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/api/login?username={username}&password={password}")]
JsonpAuthenticationResponse Login(string username, string password);
}
}
The response is just normal json:
{"Message":"unauthorized","Status":400,"Token":null}
And I want:
callbackfunction({"Message":"unauthorized","Status":400,"Token":null})
I think it has something to do with the Web.config, because when I modify the example and adjust the Web.config so it looks like mine the example doesn't function anymore. You would say I pinpointed the problem.. but no.
To supply as much as information as possible, here is the working solution from the example:
Web.config:
<?xml version="1.0"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="None" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webScriptEndpoint>
<standardEndpoint name="" crossDomainScriptAccessEnabled="true"/>
</webScriptEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
And the class:
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
namespace Microsoft.Samples.Jsonp
{
[DataContract]
public class Customer
{
[DataMember]
public string Name;
[DataMember]
public string Address;
}
[ServiceContract(Namespace="JsonpAjaxService")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class CustomerService
{
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public Customer GetCustomer()
{
return new Customer() { Name="Bob", Address="1 Example Way"};
}
}
}
The above example returns a jsonp object. This is the call from the example:
function makeCall() {
var proxy = new JsonpAjaxService.CustomerService();
proxy.set_enableJsonp(true);
proxy.GetCustomer(onSuccess, onFail, null);
}
proxy.set_enableJsonp(true); is maybe something I am missing in my call? But I can't add this in my call because I'm not calling the service from the same solution.
So any idea's about what's causing the normal JSON response instead of the request JSONP?
The problem was in the factory settings. In the marckup of the svc file I had to change the factory to System.ServiceModel.Activation.WebScriptServiceHostFactory.