[英]Xamarin Studio or Visual Studio on a VM?
我將很快開始攻讀學位課程的最后一年的項目,目標是創建一個具有ASP.NET C#前端和SOAP(或REST,尚未完全確定)Web服務后端的Web應用程序。 我將在MacBook上進行開發,這帶來了ASP.NET是Microsoft框架而Visual Studio無法用於Mac OS的問題,因此我轉向了Mono框架及其IDE Xamarin Studio。
我創建了一個非常非常基本的SOAP Web服務,可以在這里找到它,並將其部署到glassfish並可以導航到wsdl。 當我嘗試使用Xamarin Studio中的Web服務時,問題就開始了,我可以很好地設置代理,並且創建了一個非常簡單的頁面,該頁面應顯示調用add
web方法的結果。 標記:
<%@ Page Language="C#" Inherits="TryItOutNetApplication.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
<title>Default</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button id="button1" runat="server" Text="Click me!" OnClick="button1Clicked" />
Hey, the result of 1 + 2 is:
<asp:Label id="label1" runat="server" />
</form>
</body>
</html>
后面的代碼:
namespace TryItOutNetApplication
{
using System;
using System.Web;
using System.Web.UI;
using localhost;
public partial class Default : System.Web.UI.Page
{
private FYPTestWebService ws;
protected void Page_Init(object sender, EventArgs e)
{
ws = new localhost.FYPTestWebService();
}
protected void Page_Load(object sender, EventArgs e)
{
int i = ws.add(1,2);
label1.Text = i.ToString();
}
public void button1Clicked (object sender, EventArgs args)
{
button1.Text = "You clicked me";
}
}
}
然后,當我嘗試運行該應用程序時出現以下錯誤:
Application Exception
System.Net.Sockets.SocketException
Connection reset by peer
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.
Exception stack trace:
at System.Net.Sockets.Socket.EndReceive (IAsyncResult result) [0x0002d] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1816
at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x0002f] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System/System.Net.Sockets/NetworkStream.cs:32
我還沒有找到Xamarin Studio的幫助,與Visual Studio相比,它通常看起來很糟糕。
我的問題是
a)我在上面的代碼/設置中只是在做一些愚蠢的事情嗎?
b)我應該報廢Mono / Xamarin Studio並使用VirtualBox之類的東西安裝Visual Studio並改為使用它嗎?
關鍵是:您的應用程序最終將在哪里:在Windows Server或Linux Server中(或換句話說:在.NET框架或Mono框架中)。
並不是說您不能在一個框架中進行開發,而不能在另一個框架中進行部署,但是如果您在必須最終運行的同一框架中進行開發,您的驚喜就會減少!
另外,您可以同時在Visual Studio和Xamarin / Monodevelop中使用同一項目(嗯,也許有一些解決方案文件覆蓋之戰...)。
我個人建議將Visual Studio安裝到Mac上的虛擬機,至少對我來說更有意義。
嘿,您應該考慮直接在Visual Studios 2013中進行開發,它就像使用VMWare Fusion的冠軍一樣。 有一個橋連接模擬器Xamarin iOS Build Host,一旦連接就可以編寫代碼了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.