visual-studio-2008 相关问题

此标记指的是Microsoft版本的Visual Studio系列软件开发产品,2008版本。除非您有关于Visual Studio的特定问题,否则不要使用此标记 - 而不仅仅是编码问题。问题应该特定于2008版的Visual Studio。

表达式生成器需要 SPContext 才能运行

我在使用 Visual Studio 2008 网站和 SharePoint/MOSS 2007 时遇到问题。我们之前在 SharePoint 结构下放置了 2 个 Web 应用程序项目,但由于项目的性质...

回答 1 投票 0

在VS2008中构建CUDA程序出现问题:LNK2019

我在构建程序时遇到了一些麻烦。我正在使用 Visual Studio 2008 处理 Windows 7 professional 32 位。我有 Cuda SDK,并且我的项目设置了 cudart.l 的所有链接...

回答 3 投票 0

如何更改我的 wsdl 的地址位置

我的 wsdl 在地址位置放置了错误的域,如何修复? - - 我的 wsdl 在地址位置放置了错误的域,如何修复它? - <wsdl:service name="XWebService"> - <wsdl:port name="XServiceSoap" binding="tns:XWebServiceSoap"> <soap:address location="https://machine.wrongdomain.com.br/webservices/MapleStoryWebService.asmx" /> </wsdl:port> - <wsdl:port name="XWebServiceSoap12" binding="tns:XWebServiceSoap12"> <soap12:address location="https://machine.wrongdomain.com.br/webservices/XWebService.asmx" /> </wsdl:port> - <wsdl:port name="XWebServiceHttpGet" binding="tns:XWebServiceHttpGet"> <http:address location="https://machine.wrongdomain.com.br/webservices/MapleStoryWebService.asmx" /> </wsdl:port> - <wsdl:port name="XWebServiceHttpPost" binding="tns:XWebServiceHttpPost"> <http:address location="https://machine.wrongdomain.com.br/webservices/XWebService.asmx" /> </wsdl:port> </wsdl:service> 真正的域名就像https://machine.goodDomain.com.br 该地址取自用于访问 WSDL 的 URL。如果它与您想要实际提供服务的服务器不同,那么您可以通过创建一个扩展 SoapExtensionReflector 的类来更改它。以下是有关如何更改 URL 的示例文章: http://blogs.msdn.com/kaevans/archive/2005/11/16/493496.aspx 另一种选择是使用 IIS URL 重写模块 (http://www.iis.net/downloads/microsoft/url-rewrite) 首先 - 捕获 XWebService.asmx?WSDL 的输出并将其保存为 HTML 文件(例如 wsdl.htm)。 编辑此文件并将位置更改为备用地址 ...来自 thishost.domain.com: - <wsdl:port name="XWebServiceHttpPost" binding="tns:XWebServiceHttpPost"> <http:address location="http://thishost.domain.com/XWebService.asmx" /> </wsdl:port> ...至 thathost.domain.com: - <wsdl:port name="XWebServiceHttpPost" binding="tns:XWebServiceHttpPost"> <http:address location="http://thathost.domain.com/XWebService.asmx" /> </wsdl:port> 在 IIS 中 - 在网站/虚拟功能视图中找到 URL 重写图标。然后单击 添加规则 并选择 入站规则 - 空白规则。 使用规则 - 适当命名并设置将接收 WSDL 请求的 Web 服务 URL 的模式匹配。对于正则表达式: (.*)XWebservice.asmx 对于条件,将 {QUERY_STRING} 与 WSDL 以及 {REQUEST_METHOD} 与 GET 匹配。 对于Action - 将其设置为Rewrite(因此这对客户端来说是透明的)并选择我们之前保存的文件(wsdl.htm)。 这还会向 web.config 的 system.webServer 部分添加一个新的 rewrite 部分 <system.webServer> <rewrite> <rules> <rule name="WSDL Rewrite" stopProcessing="true"> <match url="(.*)XWebService.asmx" /> <conditions> <add input="{QUERY_STRING}" pattern="WSDL" /> <add input="{REQUEST_METHOD}" pattern="GET" /> </conditions> <action type="Rewrite" url="wsdl.htm" /> </rule> </rules> </rewrite> </system.webServer> 为什么不手动将 WSDL 文件中的地址编辑为应有的地址呢? 如果 WSDL 是由其他工具生成的,请告诉我们它是如何生成的,也许我们可以提供帮助。否则,没有法律禁止修改生成的文件以满足您的需要。如果原始用户环境的 WSDL 的问题只是 URL 错误,那么直接修改 URL 是完全合法的。 最初的反应是正确的。 WSDL 中的默认 URL 取决于用于访问 WSDL 的 URL。 我的团队过去处理更改服务 URL 的方式(例如,从开发环境过渡到测试或生产环境)是使用 wsdl.exe 为您的 Web 服务生成代码代理(代理实际上是通过以下方式创建的)也可以是 Web 或服务引用,但默认情况下不会显示在 Visual Studio 中),您可以编辑生成的代理类以从 (??) 任何您想要存储它的位置(数据库、配置文件等)读取服务的 URL。 解决方案很少,我会按照从简单到准确的顺序进行排序。 :) 不用担心 WSDL 中的 URL。 只需在客户端使用 Url 属性,就像在这种情况下: public class MyWebService : RemoteService { public MyWebService() : base() { Url = ConfigurationManager.AppSettings["MyServiceCustomUrl"]; } } 明显的缺点:很可能您将无法使用生成的 html(我的意思是为 Web 方法生成的表单)正确测试服务。 使用自定义wsdlHelpGenerator。 我没有测试这个解决方案,但乍一看,如果您基于原始的 DefaultWsdlHelpGenerator.aspx 创建自己的解决方案,它看起来很简单(您可以在 C:\Windows\Microsoft.NET\Framework* 文件夹中找到它) ,就我而言,它是 C:\Windows\Microsoft.NET\Framework 4.0.30319\Config\DefaultWsdlHelpGenerator.aspx)。 使用soapExtensionReflectorTypes。它将允许您使用 HttpSoap 协议地址执行任何操作。 创建一个处理程序(下面的示例将 http 更改为 https): public class HttpsReflector : SoapExtensionReflector { public override void ReflectMethod() { // nothing to override } public override void ReflectDescription() { ServiceDescription description = ReflectionContext.ServiceDescription; foreach (System.Web.Services.Description.Service service in description.Services) { foreach (Port port in service.Ports) { foreach (ServiceDescriptionFormatExtension extension in port.Extensions) { if (extension is SoapAddressBinding binding) { binding.Location = binding.Location.Replace("http://", "https://"); } } } } } } 在 web.config 中注册: <system.web> <webServices> <soapExtensionReflectorTypes> <!-- Required to replace http in addresses for HttpSoap protocol --> <add type="MyWebServices.WsdlFixHttp.HttpsReflector, MyWebServices"/> </soapExtensionReflectorTypes> </webServices> </system.web> 缺点:无法控制 HttpPost/HttpGet 协议。 实现IIS重写模块。它将允许您修改服务产生的任何输出。可以与#3一起使用。 创建2个类,流装饰器: public class StreamWatcher : Stream { private readonly Stream _base; private readonly MemoryStream _memoryStream = new MemoryStream(); public StreamWatcher(Stream stream) { _base = stream; } public override void Flush() { _base.Flush(); } public override int Read(byte[] buffer, int offset, int count) { return _base.Read(buffer, offset, count); } public override void Write(byte[] buffer, int offset, int count) { _memoryStream.Write(buffer, offset, count); _base.Write(buffer, offset, count); } public override string ToString() { return Encoding.UTF8.GetString(_memoryStream.ToArray()); } public override bool CanRead => _base.CanRead; public override bool CanSeek => _base.CanSeek; public override bool CanWrite => _base.CanWrite; public override long Seek(long offset, SeekOrigin origin) => _base.Seek(offset, origin); public override void SetLength(long value) => _base.SetLength(value); public override long Length => _base.Length; public override long Position { get => _base.Position; set => _base.Position = value; } } 和模块: public class WsdlFixHttpModule : IHttpModule { public void Init(HttpApplication context) { context.EndRequest += (s, e) => OnEndRequest(s, e); context.BeginRequest += (s, e) => OnBeginRequest(s, e); } private void OnBeginRequest(object sender, EventArgs e) { HttpContext httpContext = HttpContext.Current; if (httpContext.Request.Url.Query.Equals("?WSDL", StringComparison.InvariantCultureIgnoreCase) || IsAsmxGetRequest(httpContext)) { httpContext.Response.Filter = new StreamWatcher(httpContext.Response.Filter); } } private void OnEndRequest(object sender, EventArgs e) { HttpContext httpContext = HttpContext.Current; string oldValue = "", newValue = ""; bool replacementRequired = false; if (httpContext.Request.Url.Query.Equals("?WSDL", StringComparison.InvariantCultureIgnoreCase)) { oldValue = ":address location=\"http://"; newValue = ":address location=\"https://"; replacementRequired = true; } else if (IsAsmxGetRequest(httpContext)) { oldValue = "<form target=\"_blank\" action='http://"; newValue = "<form target=\"_blank\" action='https://"; replacementRequired = true; } if (replacementRequired) { string wsdl = httpContext.Response.Filter.ToString(); wsdl = wsdl.Replace(oldValue, newValue); httpContext.Response.Clear(); httpContext.Response.Write(wsdl); httpContext.Response.End(); } } private static bool IsAsmxGetRequest(HttpContext httpContext) { return httpContext.Response.ContentType == "text/html" && httpContext.Request.CurrentExecutionFilePathExtension.Equals(".asmx", StringComparison.InvariantCultureIgnoreCase) && httpContext.Request.HttpMethod == "GET"; } public void Dispose() { } } 然后在web.config中注册模块: <system.webServer xdt:Transform="Insert"> <modules> <!-- Required to replace http in addresses for HttpPost/HttpGet protocols --> <add name="WsdlFixHttpModule" type="MyWebServices.WsdlFixHttp.WsdlFixHttpModule, MyWebServices"/> </modules> </system.webServer> 请注意,上面的注册是集成模式,经典模式需要在里面注册system.web。 因此,在我们的遗留项目中,我使用了 3+4 方法,但如果我想再次这样做,我会尝试使用#2 方法。 :)

回答 5 投票 0

连接字符串正确时出现“实例失败”错误

我在页面加载事件上有以下代码: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 处理 Me.Load con = New SqlConnection("数据源=14GRAFICALI\

回答 9 投票 0

如何解决“HTTP 错误 404.3 - 未找到”错误?

简单的问题。我启动 VS2008 并创建一个新的 WCF 服务应用程序。这将创建一个默认应用程序,并使用一些测试方法来显示它的工作原理。我按 CTRL+F5 确实有效!...

回答 7 投票 0

ashx 通用处理程序中的 Visual Studio ASP.Net 展开和折叠问题

我有 Visual Studio 2008 Professional,但在 ASP.Net 通用处理程序页面 (.ashx) 中展开和折叠方法代码块时遇到问题 我本以为你也可以做同样的事情...

回答 5 投票 0

如何在 Visual Studio 调试器中的某个点中断循环?

我有一个 for 循环,它在字符串数组上运行 1000 多次。 我想让我的应用程序在其中一个字符串与某个术语匹配时中断。 所以我可以从那时开始浏览我的代码。 现在,我...

回答 3 投票 0

调试时如何在某个点中断循环?

环境:Visual Studio 2008 - C# 我有一个 for 在字符串数组上运行了 1000 多次。 我想让我的应用程序在其中一个字符串与某个术语匹配时中断,这样我就可以遍历该术语......

回答 3 投票 0

Visual Studio 有自动保存配置设置吗?

我使用 java IDE IntelliJ IDEA,我喜欢的功能之一是没有保存。一切都会被保存,您只需使用历史导航即可。我倾向于同时打开两个编辑器,并且我...

回答 10 投票 0

如何进入微软的.NET框架源代码?

我想进入微软的源代码但不能。 我按照配置 Visual Studio 进行调试中的说明进行操作。特别是,我禁用了“仅启用我的代码”并启用了“启用...

回答 3 投票 0

应用程序在 Visual Studio 之外冻结。从 Visual Studio 启动它时它可以工作

慢慢地我就劳累过度了... 我有一个巨大的应用程序,带有线程、计时器、调用(不是 BeginInvoke,因此它是同步的)和 Application.DoEvents。 在这里发帖太多了,我不知道为什么......

回答 5 投票 0

Visual C# Studio 项目中的哪些文件不需要版本控制?

我是 Visual C# Studio 的新手(实际上使用的是 Express 版本,但另一个开发人员正在使用完整版本),并且我们正在使用版本控制(svn)。 添加项目我可以接受...

回答 11 投票 0

需要帮助为我在 Visual-studio-2008 中的应用程序自定义 GUI

实际上,我正在尝试构建一个小“图像查看器兼编辑器”作为一个小型大学项目。现在,当我几乎完成它时,我发现它根本没有吸引力(从 GUI 的角度来看)。所以,...

回答 2 投票 0

为什么我会收到错误“仅在使用 /unsafe 进行编译时才可能出现不安全代码”?

为什么会出现以下错误? 不安全代码只有在使用 /unsafe 编译时才可能出现? 我使用 C# 和 Visual Studio 2008 在 Windows CE 上进行编程。

回答 8 投票 0

列出cmake生成的Visual Studio C++项目中的头文件

我正在为我们的产品构建一个基于 cmake 的构建系统。问题是由 cmake 生成的 Visual Studio 项目不会在解决方案浏览器中显示头文件。 我需要在 CMak 中添加什么...

回答 5 投票 0

MyAssembly.XmlSerializers.dll 生成的目的是什么?

我正在开发一个生成程序集的项目。我刚刚注意到正在生成一个附加程序集 *.XmlSerializers.dll。为什么会自动生成这个文件以及它的用途是什么?

回答 6 投票 0

Visual Studio 中按字母顺序排列的方法

是否有任何类型的插件或工具可用于 Visual Studio 2008 按字母顺序排列方法?理想情况下,我想要一个能够按字母顺序排列选择或指定类型的工具(即只有方法,而不是m...

回答 6 投票 0

InitInstance 在 UpdateWindow 处抛出异常

我正在尝试将旧项目从 VS2008 移植到 VS2015。这个项目使用MFC,我有一个编译版本,但它在 InitInstance 方法期间抛出异常,更准确地说,当有...

回答 1 投票 0

如何检测我的应用程序是否在附加了调试器的 VS 2008 中运行?

之前我做了很多WinForms组件,我们有像“InDesigner”这样的东西。我想知道是否有类似“IsWithDebuggerAttached”的东西。

回答 2 投票 0

Direct Show (AMCap) - 平台 SDK

我正在尝试同时从多个网络摄像头捕获图像,并使用 C++ 以最小的延迟自动保存它们。我还希望该程序能够更改网络摄像头的参数

回答 3 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.