有人可以帮助netTcpBinding v/s BasicHttpBinding之间的主要区别是什么?
在我当前的项目中,我们将BasicHttpBinding转换为netTcpBinding并获得性能问题,即使BizTalk中的值设置为1:00:00,它也会启动超时.我们无法弄清楚为什么?
WCF中是否需要DataContract属性?
我有一个没有用DataContract标记或没有用DataMember标记属性的类。
当我在4台服务器上部署wcf服务时,出4台服务在3台服务器上工作正常,而在1台服务器上失败,并显示消息“类型'类'无法序列化。请考虑用DataContractAttribute属性标记它,并标记要序列化的所有成员使用DataMemberAttribute属性。”
那么,web.config或machine.config或IIS中是否有任何设置可以强制我在代码中使用序列化程序?要么
如果未指定属性,我可以指定使用默认序列化程序吗?
谢谢,克里希纳
我盯着 web.config 看了很久,你们能看一下吗?
运行service.Endpoint.Address.ToString()给了我预期的结果:http://localhost:2867/Service1.svc并http://localhost:2867/Service1.svc?wsdl给了我所需的所有方法。
如果您需要更多信息/代码,我很乐意添加它。
感谢您的浏览!
错误
没有侦听端点http://localhost:2867/Service1.svc可以接受该消息。这通常是由不正确的地址或 SOAP 操作引起的。
客户端配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<pages>
<namespaces>
...
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
...
</handlers>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
<binding name="Identity Management WebserviceSoap">
<security mode="Transport" /> …Run Code Online (Sandbox Code Playgroud) 我已经创建了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) 我已经创建了一个WCF服务器和一个WCF客户端来使用该服务.服务器的目的是添加2个传入的数字,并在返回总和之前等待X毫秒.
客户端创建Y任务并启动它们.每个任务都是服务器添加数字并等待X毫秒的请求.
当x = 0且y = 1000时,完成所有任务平均需要6.2秒.当X = 0且Y = 10000时,平均需要61秒来完成所有任务.
为什么这么慢或者这可能是正常的?
谢谢达莫
客户端C#方法
private void radButtonTaskWithStatus_Click(object sender, EventArgs e)
{
try
{
var dateTime1 = DateTime.UtcNow;
radProgressBarStatus.Maximum = int.Parse(radTextBoxFloodRequests.Text);
radProgressBarStatus.Value1 = 0;
Random rnd = new Random();
Task<int>[] tasks = new Task<int>[int.Parse(radTextBoxFloodRequests.Text)];
for (int i = 0; i < int.Parse(radTextBoxFloodRequests.Text); i++)
{
int x = i;
tasks[i] = new Task<int>(() =>
{
int FirstRandomNumber = rnd.Next(1, 20);
int SecondRandomNumber = rnd.Next(1, 20);
int result = TaskRequestWithResult(FirstRandomNumber, SecondRandomNumber, int.Parse(radTextBoxFloodDelay.Text), x); …Run Code Online (Sandbox Code Playgroud) wcf ×5
wcf-binding ×5
.net ×3
c# ×2
asp.net-mvc ×1
biztalk ×1
endpoint ×1
exception ×1
performance ×1
task ×1