小编lac*_*dev的帖子

WCF - "没有端点正在侦听......"错误

我有两个应用程序,我想在同一台机器上本地测试.App 1有一个简单的WCF服务,带有folloiwng配置条目:

<service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior"
        name="MyNamespace.ContainerManagementService">
  <endpoint address="ContainerManagementService" binding="basicHttpBinding"
     name="ContainerManagementbasicHttpEndpoint"
     contract="MyNamespace.IContainer" />
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  <host>
    <baseAddresses>
      <add baseAddress="http://localhost:8000/ContainerManagementService" />
    </baseAddresses>
  </host>
</service>    
<behaviors>      
  <behavior name="MyNamespace.ContainerManagementServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
  </behavior>
</behaviors>
Run Code Online (Sandbox Code Playgroud)

我通过运行托管它的Web应用程序项目来启动该服务.我能够成功浏览到url并从ie获取Web服务信息页面.我复制相同的URL并将其用于我的客户端.

我的其他客户端App 2在其配置文件中包含以下内容:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="basicHttp" closeTimeout="00:10:00"
        openTimeout="00:10:00" receiveTimeout="00:10:00"
        sendTimeout="00:10:00" allowCookies="false"
        bypassProxyOnLocal="false"
        hostNameComparisonMode="StrongWildcard"
        maxBufferSize="5242880" maxBufferPoolSize="524288"
        maxReceivedMessageSize="5242880" messageEncoding="Text"
        textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192"
          maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
        <security mode="None">
          <transport clientCredentialType="None"
            proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client> …
Run Code Online (Sandbox Code Playgroud)

wcf

8
推荐指数
1
解决办法
6万
查看次数

尽管已设置,但FormsAuthenticationTicket的UserData属性为空

出于某种原因,我的身份验证cookie的UserData属性为空.这是代码:

var authCookie = FormsAuthentication.GetAuthCookie(userName, rememberUser.Checked);
// Get the FormsAuthenticationTicket out of the encrypted cookie
var ticket = FormsAuthentication.Decrypt(authCookie.Value);
// Create a new FormsAuthenticationTicket that includes our custom User Data
var newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, "userData");
// Update the authCookie's Value to use the encrypted version of newTicket
authCookie.Value = FormsAuthentication.Encrypt(newTicket);
// Manually add the authCookie to the Cookies collection
Response.Cookies.Add(authCookie);
FormsAuthentication.RedirectFromLoginPage(userName, rememberUser.Checked);
Run Code Online (Sandbox Code Playgroud)

以下是我尝试访问它的方法:

if (HttpContext.Current.Request.IsAuthenticated )
{
    var authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
    if (authCookie != null) …
Run Code Online (Sandbox Code Playgroud)

asp.net cookies forms-authentication

8
推荐指数
1
解决办法
9235
查看次数

使用SQL Azure的LINQ to SQL

我们正在研究迁移到云模型和Microsoft Azure PaaS平台.

我们当前的数据层是使用LINQ to SQL编写的.它是否与SQL Azure兼容?

azure linq-to-sql azure-sql-database

7
推荐指数
1
解决办法
3196
查看次数

将XSLT应用于WCF消息

如果满足某些条件,我们希望从WCF请求转换传出XML.有没有办法在使用WCF进行连接之前拦截XML流?我发现了一种使用Message对象并覆盖OnWriteBodyContents方法的方法,你必须手动创建XML,理想情况下我们想要一个更简单的方法.

.net xml wcf

6
推荐指数
1
解决办法
1283
查看次数

VS2010单元测试 - 使用不同参数重新运行相同的测试

我有一个单元测试,根据传递的参数,行为不同.VS 2010 MS测试框架是否具有使用不同参数调用相同测试的功能.我正在寻找这样的东西:

[TestRun(False)]
[TestRun(True)]
[TestMethod]
public void FooTest(bool a)
{
   RunTest(a);
}
Run Code Online (Sandbox Code Playgroud)

unit-testing mstest visual-studio-2010

6
推荐指数
1
解决办法
2740
查看次数

WCF数据服务 - 请求错误

我在LINQ to SQL数据上下文之上做一个简单的WCF数据服务.我的svc.cs文件非常简单.但是,当我从VS2012运行它时,我得到一个通用的"请求错误",没有更多的信息.我该如何排除故障/解决它?

using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
using MyApp.Business.Pmw.DataAccess;

namespace MyApp.DataService
{
    public class SystemData : DataService<PmwModelDataContext>
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("SysParam", EntitySetRights.ReadMultiple);            
            // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
            // Examples:
            // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
            // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

wcf-data-services

6
推荐指数
1
解决办法
4415
查看次数

在 Office 07 中打开生成的 Excel 文件时出现警告消息

我使用 stackoverflow 上概述的 XML 格式生成了一个 excel 文件,在下面的文章中: 在 .net 中生成 excel 文件

但是,当我在 Excel 07 中打开它时,我收到以下消息:

您尝试打开的文件“blah.xls”的格式与文件扩展名指定的格式不同。打开文件之前,请验证该文件没有损坏并且来自受信任的来源。您想现在打开该文件吗?

是什么导致了错误消息以及如何消除它?谢谢!

.net xml excel

5
推荐指数
1
解决办法
7031
查看次数

vs2010单元测试毫无理由地中止

我们最近将TFS 2008服务器关闭了.它是使用TFS 2010服务器重建的.现在,当我选择VS单元测试并运行时,前几个标记为"已中止",其他标记为"未执行"...这种情况在没有任何输入的情况下发生.坠机前单元测试工作正常.可能导致什么?

谢谢.

unit-testing visual-studio-2010 tfs2010

5
推荐指数
1
解决办法
5313
查看次数

捕获对soapUI测试运行的响应

我正在使用soapUI的testrunner.bat来从命令行执行测试.我想检查对Web服务调用的响应.这可以通过UI轻松完成,但我还没有看到将响应转储到文件的选项.这是我正在使用的命令:

testrunner.bat -sSuite -cPingProduction -r -I"C:\ Program Files\eviware\Projects\Project-webchecker-soapui-project.xml"

此命令确实生成了一个日志文件,但它没有响应/请求.

谢谢.

web-services soapui

5
推荐指数
1
解决办法
3458
查看次数

WCF - 动态调用实现相同接口的不同Web服务端点

我有许多不同的应用程序来实现相同的合同.在我的主应用程序中,我想有一个代理.然后动态地,给定特定应用程序的Uri,我将创建一个Web服务请求并调用它.怎么能实现呢?谢谢!

wcf

3
推荐指数
1
解决办法
4290
查看次数