简体   繁体   中英

Xamarin Studio or Visual Studio on a VM?

I will be starting my final year project for my degree soon and am aiming to create a web application with an ASP.NET C# front-end and a SOAP (or REST, haven't fully decided yet) web service back-end. I will be developing on my MacBook, which poses the problem with ASP.NET being a Microsoft framework and Visual Studio not being available for Mac OS, so I have turned to the Mono framework and its IDE, Xamarin Studio.

I have created a very, very basic SOAP web service which can be found here , deployed it to glassfish and can navigate to the wsdl. The problems start when I try and consume the web service from Xamarin Studio, I can get the proxy set up fine and I have created a very simple page that should display the result of calling the add web method. The markup:

<%@ 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>

The code-behind:

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";
        }
    }
}

I then get the following error when I try and run the application:

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

I have not been able to find any help for Xamarin Studio and it generally seems pretty awful compared to Visual Studio.

My question is

a) am I just doing something stupid with my above code/setup?

b) should I scrap Mono/Xamarin Studio and use something like VirtualBox to install Visual Studio and use that instead?

The point is: where will your application finally has to be: in a Windows Server or a Linux Server (or in other words: in a .NET framework or a Mono framework).

It's not that you cannot develop in one framework and deploy to other, but if you develop in the same framework where it has to finally run you will have less surprises!

Also, you can work with the same project in Visual Studio and Xamarin/Monodevelop at the same time (well, maybe with a little of solution file overwriting battle...) .

我个人建议将Visual Studio安装到Mac上的虚拟机,至少对我来说更有意义。

Hey you should consider developing directly in Visual Studios 2013 it works like a champ using VMWare Fusion. there is a bridge that connects the simulator called Xamarin iOS Build Host, once that connects you will be ready to code!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM