生产中的asp.net Web服务错误,而不是本地错误

时间:2014-10-02 09:54:51

标签: asp.net vb.net web-services

希望我发布在正确的区域!

我有一个内置于VS2012的asp.net/vb网络服务。该项目在.net 4.0下本地运行,但该项目的创建使用.net 2.0,因为这是生产服务器运行的。

Web服务在本地运行正常,但在生产服务器上,我收到错误(我希望格式化工作): -

BC30068: Expression is a value and therefore cannot be the target of an assignment.

这是我的功能和属性: -

Public Class JobData
    Private m_ID As Integer
    Public Property ID() As Integer
        Get
            Return m_ID
        End Get
        Set(value As Integer)
            m_ID = value
        End Set
    End Property

    Private m_MAID As Integer
    Public Property MAID() As Integer
        Get
            Return m_MAID
        End Get
        Set(value As Integer)
            m_MAID = value
        End Set
    End Property

    Private m_DateAdded As DateTime
    Public Property DateAdded() As DateTime
        Get
            Return m_DateAdded
        End Get
        Set(value As DateTime)
            m_DateAdded = value
        End Set
    End Property

    Private m_ClientID As Integer
    Public Property ClientID() As Integer
        Get
            Return m_ClientID
        End Get
        Set(value As Integer)
            m_ClientID = value
        End Set
    End Property

    Private m_JobRef As String
    Public Property JobRef() As String
        Get
            Return m_JobRef
        End Get
        Set(value As String)
            m_JobRef = value
        End Set
    End Property

    Private m_JobTitle As String
    Public Property JobTitle() As String
        Get
            Return m_JobTitle
        End Get
        Set(value As String)
            m_JobTitle = value
        End Set
    End Property

    Private m_Location As String
    Public Property Location() As String
        Get
            Return m_Location
        End Get
        Set(value As String)
            m_Location = value
        End Set
    End Property

    Private m_JobType As String
    Public Property JobType() As String
        Get
            Return m_JobType
        End Get
        Set(value As String)
            m_JobType = value
        End Set
    End Property

    Private m_Salary As String
    Public Property Salary() As String
        Get
            Return m_Salary
        End Get
        Set(value As String)
            m_Salary = value
        End Set
    End Property

    Private m_SalaryTerm As String
    Public Property SalaryTerm() As String
        Get
            Return m_SalaryTerm
        End Get
        Set(value As String)
            m_SalaryTerm = value
        End Set
    End Property

    Private m_BriefDescription As String
    Public Property BriefDescription() As String
        Get
            Return m_BriefDescription
        End Get
        Set(value As String)
            m_BriefDescription = value
        End Set
    End Property

    Private m_MoreDetails As String
    Public Property MoreDetails() As String
        Get
            Return m_MoreDetails
        End Get
        Set(value As String)
            m_MoreDetails = value
        End Set
    End Property

    Private m_DetailsDocument As String
    Public Property DetailsDocument() As String
        Get
            Return m_DetailsDocument
        End Get
        Set(value As String)
            m_DetailsDocument = value
        End Set
    End Property

    Private m_ClosingDate As DateTime
    Public Property ClosingDate() As DateTime
        Get
            Return m_ClosingDate
        End Get
        Set(value As DateTime)
            m_ClosingDate = value
        End Set
    End Property

    Private m_CompanyName As String
    Public Property CompanyName() As String
        Get
            Return m_CompanyName
        End Get
        Set(value As String)
            m_CompanyName = value
        End Set
    End Property

    ' User for HTML
    Public Property HTMLData() As String
        Get
            Return m_Data
        End Get
        Set(value As String)
            m_Data = value
        End Set
    End Property
    Private m_Data As String
End Class
Public Class JobBoard
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(value As String)
            m_Name = value
        End Set
    End Property
    Private m_Name As String

    Public Property WSID() As String
        Get
            Return m_WSID
        End Get
        Set(value As String)
            m_WSID = value
        End Set
    End Property
    Private m_WSID As String

    Public Property JobDetails() As List(Of JobData)
        Get
            Return m_JobDetails
        End Get
        Set(value As List(Of JobData))
            m_JobDetails = value
        End Set
    End Property
    Private m_JobDetails As List(Of JobData)
End Class



Public Shared Function getJobsForWSID(ByVal wsid As String, ByRef mj As JobBoard) As JobBoard
    Dim mysql As String = RWP.OtherFormats.masterSelect(wsid).ToString.Trim
   ' HttpContext.Current.Response.Write(mysql) : HttpContext.Current.Response.End()
    Dim Conn As New MySqlConnection(dbconn)
    Dim da As New MySqlDataAdapter(mysql, Conn)
    Dim dt As New DataTable
    Conn.Open()
    da.Fill(dt)
    Dim mytask As DataRow() = dt.[Select]
    If dt.Rows.Count > 0 Then
        For Each dr As DataRow In mytask

             ' THIS LINE CAUSES THE ERROR
             mj.JobDetails.Add(New JobData() With {.ID = dr("id"), .MAID = dr("master_agency_id"), .DateAdded = dr("date_added"), .ClientID = dr("client_id"), .JobRef = ts(dr("job_ref")), .JobTitle = ts(dr("job_title")), .Location = ts(dr("location")), .JobType = ts(dr("job_type")), .Salary = ts(dr("salary")), .SalaryTerm = ts(dr("salary_term")), .BriefDescription = ts(dr("brief_desc")), .MoreDetails = ts(dr("more_details")), .DetailsDocument = ts(dr("details_document")), .ClosingDate = dr("closing_date"), .CompanyName = dr("company_name")})

        Next
    End If
    da = Nothing
    Conn.Close()
    Conn.Dispose()
    Conn = Nothing
    dt = Nothing

    Return mj

End Function

这是编译器输出: -

D:\inetpub\vhosts\api.rankcareers.co.uk\httpdocs\App_Code\acesapiws1.vb(254) : error BC30068: Expression is a value and therefore cannot be the target of an assignment.

    mj.JobDetails.Add(New JobData() With {.ID = dr("id"), .MAID = dr("master_agency_id"), .DateAdded = dr("date_added"), .ClientID = dr("client_id"), .JobRef = ts(dr("job_ref")), .JobTitle = ts(dr("job_title")), .Location = ts(dr("location")), .JobType = ts(dr("job_type")), .Salary = ts(dr("salary")), .SalaryTerm = ts(dr("salary_term")), .BriefDescription = ts(dr("brief_desc")), .MoreDetails = ts(dr("more_details")), .DetailsDocument = ts(dr("details_document")), .ClosingDate = dr("closing_date"), .CompanyName = dr("company_name")})
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
D:\inetpub\vhosts\api.rankcareers.co.uk\httpdocs\App_Code\acesapiws1.vb(254) : error BC32017: Comma, ')', or a valid expression continuation expected.

    mj.JobDetails.Add(New JobData() With {.ID = dr("id"), .MAID = dr("master_agency_id"), .DateAdded = dr("date_added"), .ClientID = dr("client_id"), .JobRef = ts(dr("job_ref")), .JobTitle = ts(dr("job_title")), .Location = ts(dr("location")), .JobType = ts(dr("job_type")), .Salary = ts(dr("salary")), .SalaryTerm = ts(dr("salary_term")), .BriefDescription = ts(dr("brief_desc")), .MoreDetails = ts(dr("more_details")), .DetailsDocument = ts(dr("details_document")), .ClosingDate = dr("closing_date"), .CompanyName = dr("company_name")})

有谁能说明为什么会这样?

0 个答案:

没有答案