码:
public class ABC.Server.Modules.XService :
ABC.Server.Common.IGenericService<ABC.Server.Module.X.MyType>
{
ABC.Server.Common.GenericResponse<ABC.Server.Module.X.MyType> DoFoo(ABC.Server.Common.GenericRequest<ABC.Server.Module.X.MyType> request)
{
//Do Stuff Here
}
}
Run Code Online (Sandbox Code Playgroud)
简明代码:
public class XService :
IGenericService<MyType>
{
GenericResponse<MyType> DoFoo(GenericRequest<MyType> request)
{
//Do Stuff Here
}
}
Run Code Online (Sandbox Code Playgroud)
Web.config:
我不使用SVC文件,而是在Web.config中处理了这些信息:
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="Services/X.svc"
service="ABC.Server.Modules.X.XService"/>
<service name="ABC.Server.Modules.X.XService"
behaviorConfiguration="StandardBehavior">
<endpoint bindingConfiguration="StandardBinding"
binding="basicHttpBinding"
contract="?" />
</service>
Run Code Online (Sandbox Code Playgroud)
我如何在合同名称中加入实际工作?
我为我的SOAP端点工作了SSL.
但是一旦我启用了我的REST端点,它就会抛出一个拟合:
Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].
Run Code Online (Sandbox Code Playgroud)
我的app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IIncreasedBufferSize" maxBufferSize="1024000"
maxReceivedMessageSize="1024000">
<readerQuotas maxArrayLength="1024000" />
<security mode ="Transport">
<transport clientCredentialType= "None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="WCFBehaviourSSL"
name="IWCF.IService">
<endpoint name="soap" address="soap" binding="basicHttpBinding" bindingConfiguration="IIncreasedBufferSize"
contract="IWCF.IServices">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint name="rest"
address="rest"
binding="webHttpBinding"
contract="IWCF.IServices"
behaviorConfiguration="REST" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary2/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors> …
Run Code Online (Sandbox Code Playgroud) 我正在通过Windows Azure上的ASP.NET应用程序托管我的REST服务.它工作得很完美,但几天前我需要一个角色间通信服务,我建立了我的服务,但我有托管它的问题.
我的Global.asax中的此代码在我的本地Azure开发服务器中运行良好,但它在Azure云中不起作用.
正确托管它们的最佳方法是什么?
Global.asax中:
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
StartNotificationServiceHost();
RegisterRoutes();
}
public ServiceHost ServiceHost { get; private set; }
private void RegisterRoutes()
{
var hostfactory = new WebServiceHostFactory();
RouteTable.Routes.Add(new ServiceRoute("REST/Companies",hostfactory, typeof(Companies)));
RouteTable.Routes.Add(new ServiceRoute("REST/Public", hostfactory, typeof(Public)));
RouteTable.Routes.Add(new ServiceRoute("REST/Users", hostfactory, typeof(Users)));
RouteTable.Routes.Add(new ServiceRoute("REST/Contacts", hostfactory, typeof(Contacts)));
RouteTable.Routes.Add(new ServiceRoute("REST/Projects", hostfactory, typeof(Projects)));
RouteTable.Routes.Add(new ServiceRoute("REST/Instances", hostfactory, typeof(Instances)));
RouteTable.Routes.Add(new ServiceRoute("REST/Activity", hostfactory, typeof(Activity)));
RouteTable.Routes.Add(new ServiceRoute("REST/Search", hostfactory, typeof(Search)));
RouteTable.Routes.Add(new ServiceRoute("REST/Tasks", hostfactory, typeof(Tasks)));
RouteTable.Routes.Add(new ServiceRoute("REST/Documents", hostfactory, typeof(Documents)));
}
private void StartNotificationServiceHost() …
Run Code Online (Sandbox Code Playgroud) 我通过java与salesforce集成.我想在salesforce沙箱上测试它,所以我使用END POINT:https://test.salesforce.com/services/Soap/u/21.0
ConnectorConfig config = new ConnectorConfig();
config.setUsername(LoginHelper.userName);
config.setPassword(LoginHelper.password);
config.setServiceEndpoint(LoginHelper.END_POINT);
PartnerConnection pCon = Connector.newConnection(config);
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误,如: Invalid username, password, security token; or user locked out.
请帮忙!
我需要能够根据从http出站端点返回的http响应代码执行某些操作.例如,如果我得到500错误或302重定向或200.我需要一种方法来评估500,302,200.我知道如何使用Choice-When,但不知道如何使用Choice访问响应代码groovy或你建议的任何东西.
我已经创建了WCF服务,并且Web.Config文件具有以下设置。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" sendTimeout="10:00:00" openTimeout="10:00:00">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Axis.OptimizationService.RMSCalculationService">
<endpoint address="" binding="basicHttpBinding" …
Run Code Online (Sandbox Code Playgroud) 我是 Angular2 的新手。我想要一个单一的类或一个配置文件,其中包含我可以在所有服务中注入的所有 API 端点(允许参数等在不同的路由中)。在 Angular2 中这样做的最佳方法是什么?我的意思是,我应该像定义服务时那样定义一个 @Injectable 类(然后将它添加到我的服务的提供者中)。
我发现的问题是,当我将我的 api 部署到客户端部分的服务器上时,我必须更改所有以字符串格式调用的端点,因此如果我有许多端点可以使用,这将是浪费时间。
在此示例中,我使用字符串格式的端点调用服务:
getData() {
return this._http.get('http://localhost:8000/cartography')
.map(function(res) {
const jsonArray = res.json();
const newJsonArr = [];
for ( let i = 0; i < jsonArray.length; i++) {
const object = {
post_name : jsonArray[i].name,
employment_name : jsonArray[i].employment.name,
profession_name : jsonArray[i].employment.profession.name,
family_name : jsonArray[i].employment.profession.family.name
};
newJsonArr.push(object);
}
return newJsonArr;
});
}
Run Code Online (Sandbox Code Playgroud)
所以我正在寻找一种在类或配置文件中将其定义为全局变量的方法。任何帮助请!谢谢 。