GVKun编程网logo

Xamarin.Forms项目无法添加服务引用(无法添加对项目的引用)

15

本文将为您提供关于Xamarin.Forms项目无法添加服务引用的详细介绍,我们还将为您解释无法添加对项目的引用的相关知识,同时,我们还将为您提供关于.netWeb服务:无法添加服务引用,仅限Web引

本文将为您提供关于Xamarin.Forms项目无法添加服务引用的详细介绍,我们还将为您解释无法添加对项目的引用的相关知识,同时,我们还将为您提供关于.net Web服务:无法添加服务引用,仅限Web引用、c# – 无法添加服务引用、c# – 添加服务引用异常:无法连接到远程服务器、c# – 缺少Xamarin.Forms .NetStandard的系统引用的实用信息。

本文目录一览:

Xamarin.Forms项目无法添加服务引用(无法添加对项目的引用)

Xamarin.Forms项目无法添加服务引用(无法添加对项目的引用)

Xamarin.Forms项目无法添加服务引用

创建的Xamarin.Forms项目中,右击“引用”选项,在弹出的菜单中没有“添加服务引用”命令。这是由于该项目是支持Windows Phone 8.1导致的。在项目属性中,去除对Windows Phone 8.1的引用即可。在去除的时候,需要先卸载Nuget安装的组件包。

.net Web服务:无法添加服务引用,仅限Web引用

.net Web服务:无法添加服务引用,仅限Web引用

我有一个现有的项目,消耗Web服务.一个被添加为服务引用,另一个作为Web引用.我不记得为什么一个被添加为网络参考,但也许是因为我无法让它工作!

一个Web服务的现有服务参考工作正常,所以它不是一个.net版本问题.

我可以成功地为第二个Web服务创建一个服务引用,但没有一个方法可用. .wsdl显示了模式,但是Reference.vb只显示了Namespace,也没有显示任何方法.

要澄清,这是两个不同的第三方网络服务提供商.

我们想转到服务参考,所以我们对配置有更多的控制权,因为我们遇到了超时的各种问题.

以前有人遇到过吗?

编辑

地址上有两个服务是否重要?

编辑

我使用的是.net 3.5和VS2008.

alt text http://img139.imageshack.us/img139/719/addservicereference.gif

解决方法

添加服务引用功能众所周知的是一只猪,并且是错误的 – 我大部分时间都使用它,但是偶尔会遇到生成的代码或者是这样的(即不存在的)或者不重用类型的问题应该做.

您应该尝试使用svcutil命令行工具(打开VS命令提示符来运行它),尽管它与VS的引用功能类似,实际上是一个完全不同的代码库.您可以使用它来生成代理,所有客户端类型等,与服务引用功能一样.

最重要的是,似乎几乎所有的时间都可以工作 – 只要服务本身是合理的.

c# – 无法添加服务引用

c# – 无法添加服务引用

我已经开始学习WCF了.我写了一个简单的服务来通过LINQ查询sql关系.

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = aspNetCompatibilityRequirementsMode.Allowed)]
public class Order_WCFService 
   {

    [OperationContract]    
    public List<Order> getorders()
    {
        List<Order> orderList= null;

        try
        {
            orderList= DAL.GetList<Order>();
            return orderList;
        }
        catch (Exception)
        {
            throw;
        }
    }     
}

它位于ASP.NET-MVC项目中.

我有一个简单的silverlight应用程序.它在同一个解决方案中,但在另一个项目中.

我想通过silverlight应用程序来使用我的服务.

我尝试“添加服务引用…”并在左侧列中列出了所有可用的ASMX和WCF服务.当我点击任何服务时,它会尝试下载服务信息,但在10-20秒后失败:“在尝试查找服务时发生错误(详细信息)……”

我在这做错了什么?

谢谢

我100%肯定服务是有用的,因为我可以通过AJAX调用它们.

解决方法:

也许是一个愚蠢的问题,但是当您尝试添加服务引用时服务正在运行(如果您使用的是Visual Studio的内置Web服务器,它是否已启动并且包含该服务的ASP.NET MVC项目正在运行)?此外,您可以尝试在“添加服务引用”对话框中提供WSDL的完整地址,而不是在验证浏览器中可以访问此WSDL之后从列表中选择它.

c# – 添加服务引用异常:无法连接到远程服务器

c# – 添加服务引用异常:无法连接到远程服务器

从控制台应用程序客户端调用时,我的WCF服务返回结果.但是,它显示

Exception: Unable to connect to Remote Server

实际错误:

Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match
the proxy; the existing proxy is invalid. Refer to the stack trace for
more detail. You can try to recover by starting a new proxy,restoring
to default configuration,or refreshing the service.

错误详情:

The server was unable to process the request due to an internal error.
For more information about the error,either turn on
IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute
or from the configuration behavior) on the server in
order to send the exception information back to the client,or turn on
tracing as per the Microsoft .NET Framework SDK documentation and
inspect the server trace logs.

Server stack trace: at
System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
reply,MessageFault fault,String action,MessageVersion version,
FaultConverter faultConverter) at
System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime
operation,ProxyRpc& rpc) at
System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway,ProxyOperationRuntime operation,Object[] ins,
Object[] outs,TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall,ProxyOperationRuntime operation) at
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg,IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData,Int32 type) at IJiraService.GetProjects() at
JiraServiceClient.GetProjects()

请注意,当fiddler正在运行时,该服务正常工作.但是,如果我关闭fiddler,则会显示异常:

这是fiddler日志(当我得到数据时):

TTP / 1.1 200连接建立
日期:星期四,06八月2015 14:39:22 GMT
代理连接:保持活动
通过:1.1 localhost.localdomain

加密的HTTPS流量流经此CONNECT隧道.在fiddler中启用HTTPS解密,因此在此隧道中运行的解密会话将显示在“Web会话”列表中.

安全协议:Tls
密码:Aes128 128bits
哈希算法:Sha1 160bits
密钥交换:ECDHE_RSA(0xae06)256bits

==服务器证书==========
[学科]
CN = *.atlassian.net,O =“Atlassian Network Services,Inc.”,L =旧金山,S =加利福尼亚州,C = US

[发行者]
CN = DigiCert SHA2高保证服务器CA,OU = www.digicert.com,O = DigiCert Inc,C = US

[序列号]
08E828A2F8C521A2DC7121A28E191837

[不在之前]
9/9/2014 5:30:00 AM

[不后]
11/15/2017 5:30:00 PM

[指纹]
EA57BE3C6CDA33E6D875889944EE61284E39D91D

HTTP / 1.1 200 OK
服务器:Nginx
日期:星期四,06八月2015 14:39:26 GMT
Content-Type:application / json; charset = UTF-8
传输编码:分块
连接:保持活着
vary:Accept-Encoding
X-AREQUESTID:39x4118x1
X-ASEN:SEN-2425233
Set-Cookie:JSESSIONID = 8B68E46928883CA9F99382A67C228541;路径= /;安全;仅Http
Set-Cookie:studio.crowd.tokenkey =“”;域= .clientname.atlassian.net; Expires = Thu,01-Jan-1970 00:00:10 GMT;路径= /;安全;仅Http
X-Seraph登录原因:OUT
Set-Cookie:studio.crowd.tokenkey = YcO0N1IItmmGYah6bzgN0w00;域= .clientname.atlassian.net;路径= /;安全;仅Http
X-Seraph-LoginReason:好的
Set-Cookie:atlassian.xsrf.token = ALMX-0SVV-VVCK-3Y73 | c420e5bfab5c997ccdfa21ffa129d60a69af0013 | lin;路径= /;安全
X-ASESSIONID:b2v6it
X-AUSERNAME:admin
X-ATENANT-ID:clientname.atlassian.net
缓存控制:无缓存,无存储,无变换
X-Content-Type-Options:nosniff
严格传输安全性:max-age = 315360000; includeSubDomains

根据以上fiddler日志是我必须在web.config文件中更改以使其正常工作?

当从WCF测试客户端调用时.这是我试过的:

Web.config文件:

<?xml version="1.0"?>
  <configuration>
  <!--<system.net>
   <defaultProxy useDefaultCredentials="true" >
  </defaultProxy>
 </system.net>-->
<appSettings>
<add key="UserName" value="admin"/>
<add key="Password" value="admin"/>
<add key="resturl" value="https://Clientname.atlassian.net/rest/api/2/"/>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
 <system.web>
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime targetFramework="4.5"/>
 </system.web>
 <system.serviceModel>
  <bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IJiraService"/>
    </basicHttpBinding>
    </bindings>
   <client>
     <endpoint address="http://localhost:19065/JiraService.svc"  binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IJiraService" contract="ServiceReference1.IJiraService"
       name="BasicHttpBinding_IJiraService" />
    </client>
    <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"/>
 </system.webServer>

</configuration>

以下是我在代码中的请求方式:

public class Service : IService
{
    private string GetRestURL()
    {
        return System.Configuration.ConfigurationManager.AppSettings["resturl"];
    }

    private string GetUserName()
    {
        return System.Configuration.ConfigurationManager.AppSettings["MyUserName"];
    }

    private string getpassword()
    {
        return System.Configuration.ConfigurationManager.AppSettings["MyPassword"];
    }

 public string method()
 {
       HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
        // HttpClient 


        request.ContentType = "application/json; charset=UTF-8";
        //request.ContentType = "text/xml; charset=UTF-8";
        /*request.Headers.Add("X-Atlassian-Token","nocheck");
        request.UseDefaultCredentials = true;
        request.KeepAlive = true;*/
        request.Method = method;

        /*if (data != null)
        {
            using (StreamWriter writer = new StreamWriter(request.GetRequestStream(),Encoding.ASCII))
            {
                writer.Write(data);
            }
        }*/
        string base64Credentials = GetEncodedCredentials();
        request.Headers.Add("Authorization","Basic " + base64Credentials);



     try
     {
        request.Headers.Add("Authorization","Basic " + base64Credentials);

        response = request.GetResponse() as HttpWebResponse; //here its NULL

        if (response.StatusCode != HttpStatusCode.OK)
        {
                throw new Exception(String.Format("Server error (HTTP {0}:{1}).",response.StatusCode,response.StatusDescription));
        }
    }
    catch (Exception ex) //Here I'm getting exception
    {
        throw new Exception(ex.Message);
    }
 }

这是我的方法签名:

[ServiceContract]
public interface IService
{
    [OperationContract]
    List<ProjectDescription> GetProjects();
 }

注意:“方法”从“GetProjects”中被调用

这是通过调用WCF测试客户端调试时得到的内部异常:

这是我内心的异常

A connection attempt Failed because the connected party did not properly respond after a period of time,or established connection Failed because connected host has Failed to respond 165.254.xxx.xxx:443

注意:当我从控制台应用程序进行调试时,没有调试异常.正如我所说,控制台应用程序正常工作,我可以从服务返回结果.

更新:当我在控制台应用程序中添加这个服务作为“添加引用”时,它的工作正常.但是,当我在同一个控制台应用程序中添加为“添加服务引用”时,它显示同样的错误.我的网络是阻止某些东西吗?请帮忙.

如何纠正?还有什么我需要添加到web.config中吗?或者我需要允许URL作为受信任的URL吗?

解决方法

通过在IIS中添加代理解决问题.

总结

以上是小编为你收集整理的c# – 添加服务引用异常:无法连接到远程服务器全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

c# – 缺少Xamarin.Forms .NetStandard的系统引用

c# – 缺少Xamarin.Forms .NetStandard的系统引用

我的 Xamarin.Forms项目针对.NETStandard 1.4并导入便携式系统存在系统引用问题.

为.NETCore导入相关的可移植配置文件和System NuGet包,但Xamarin.Forms(PCL)不接受它们.

有没有解决这个问题?

{
  "supports": {},"dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1","NETStandard.Library": "1.6.0","System.ComponentModel": "4.0.1","System.Diagnostics.Tools": "4.3.0-preview1-24530-04","System.Resources.ResourceManager": "4.3.0-preview1-24530-04","System.Runtime.Serialization.Primitives": "4.1.1","Prism.Core": "6.2.1","Prism.Forms": "6.2.0","Prism.Unity.Forms": "6.2.0","Xamarin.Forms": "2.3.2.127"
  },"frameworks": {
    "netstandard1.4": {
      "imports": "portable-net45+win81"
    }
  }
}

像这样获取构建错误:

The type ‘IEditableObject’ is defined in an assembly that is not
referenced. You must add a reference to assembly
‘System.ComponentModel,Version=4.0.0.0,Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a’.

…还有这个:

The type name ‘GeneratedCodeAttribute’ Could not be found in the
namespace ‘System.CodeDom.Compiler’. This type has been forwarded to
assembly ‘System.Diagnostics.Tools,Version=0.0.0.0,
PublicKeyToken=b03f5f7f11d50a3a’ Consider adding a reference to that
assembly.

解决方法

我升级到Visual Studio 2017,这个问题就消失了.

今天的关于Xamarin.Forms项目无法添加服务引用无法添加对项目的引用的分享已经结束,谢谢您的关注,如果想了解更多关于.net Web服务:无法添加服务引用,仅限Web引用、c# – 无法添加服务引用、c# – 添加服务引用异常:无法连接到远程服务器、c# – 缺少Xamarin.Forms .NetStandard的系统引用的相关知识,请在本站进行查询。

本文标签: